Commit 6b8e30b6 authored by Michal Kubiak's avatar Michal Kubiak Committed by Tony Nguyen
Browse files

idpf: add virtchnl functions to manage selected queues



Implement VC functions dedicated to enabling, disabling and configuring
not all but only selected queues.

Also, refactor the existing implementation to make the code more
modular. Introduce new generic functions for sending VC messages
consisting of chunks, in order to isolate the sending algorithm
and its implementation for specific VC messages.

Finally, rewrite the function for mapping queues to q_vectors using the
new modular approach to avoid copying the code that implements the VC
message sending algorithm.

Signed-off-by: default avatarMichal Kubiak <michal.kubiak@intel.com>
Co-developed-by: default avatarAlexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: default avatarAlexander Lobakin <aleksander.lobakin@intel.com>
Tested-by: default avatarRamu R <ramu.r@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent dc1dea79
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1365,6 +1365,7 @@ static int idpf_txq_group_alloc(struct idpf_vport *vport, u16 num_txq)
			q->tx_min_pkt_len = idpf_get_min_tx_pkt_len(adapter);
			q->netdev = vport->netdev;
			q->txq_grp = tx_qgrp;
			q->rel_q_id = j;

			if (!split) {
				q->clean_budget = vport->compln_clean_budget;
+3 −0
Original line number Diff line number Diff line
@@ -614,6 +614,7 @@ libeth_cacheline_set_assert(struct idpf_rx_queue,
 * @dma: Physical address of ring
 * @q_vector: Backreference to associated vector
 * @buf_pool_size: Total number of idpf_tx_buf
 * @rel_q_id: relative virtchnl queue index
 */
struct idpf_tx_queue {
	__cacheline_group_begin_aligned(read_mostly);
@@ -684,7 +685,9 @@ struct idpf_tx_queue {
	dma_addr_t dma;

	struct idpf_q_vector *q_vector;

	u32 buf_pool_size;
	u32 rel_q_id;
	__cacheline_group_end_aligned(cold);
};
libeth_cacheline_set_assert(struct idpf_tx_queue, 64,
+734 −426

File changed.

Preview size limit exceeded, changes collapsed.

+29 −3
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@
#ifndef _IDPF_VIRTCHNL_H_
#define _IDPF_VIRTCHNL_H_

#include "virtchnl2.h"

#define IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC	(60 * 1000)
#define IDPF_VC_XN_IDX_M		GENMASK(7, 0)
#define IDPF_VC_XN_SALT_M		GENMASK(15, 8)
@@ -114,6 +116,33 @@ int idpf_recv_mb_msg(struct idpf_adapter *adapter);
int idpf_send_mb_msg(struct idpf_adapter *adapter, u32 op,
		     u16 msg_size, u8 *msg, u16 cookie);

struct idpf_queue_ptr {
	enum virtchnl2_queue_type	type;
	union {
		struct idpf_rx_queue		*rxq;
		struct idpf_tx_queue		*txq;
		struct idpf_buf_queue		*bufq;
		struct idpf_compl_queue		*complq;
	};
};

struct idpf_queue_set {
	struct idpf_vport		*vport;

	u32				num;
	struct idpf_queue_ptr		qs[] __counted_by(num);
};

struct idpf_queue_set *idpf_alloc_queue_set(struct idpf_vport *vport, u32 num);

int idpf_send_enable_queue_set_msg(const struct idpf_queue_set *qs);
int idpf_send_disable_queue_set_msg(const struct idpf_queue_set *qs);
int idpf_send_config_queue_set_msg(const struct idpf_queue_set *qs);

int idpf_send_disable_queues_msg(struct idpf_vport *vport);
int idpf_send_config_queues_msg(struct idpf_vport *vport);
int idpf_send_enable_queues_msg(struct idpf_vport *vport);

void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q);
u32 idpf_get_vport_id(struct idpf_vport *vport);
int idpf_send_create_vport_msg(struct idpf_adapter *adapter,
@@ -130,9 +159,6 @@ void idpf_vport_dealloc_max_qs(struct idpf_adapter *adapter,
int idpf_send_add_queues_msg(const struct idpf_vport *vport, u16 num_tx_q,
			     u16 num_complq, u16 num_rx_q, u16 num_rx_bufq);
int idpf_send_delete_queues_msg(struct idpf_vport *vport);
int idpf_send_enable_queues_msg(struct idpf_vport *vport);
int idpf_send_disable_queues_msg(struct idpf_vport *vport);
int idpf_send_config_queues_msg(struct idpf_vport *vport);

int idpf_vport_alloc_vec_indexes(struct idpf_vport *vport);
int idpf_get_vec_ids(struct idpf_adapter *adapter,