Skip to content

Commit a5ab9ee

Browse files
jahay1anguy11
authored andcommitted
idpf: add singleq start_xmit and napi poll
Add the start_xmit, TX and RX napi poll support for the single queue model. Unlike split queue model, single queue uses same queue to post buffer descriptors and completed descriptors. Signed-off-by: Joshua Hay <[email protected]> Co-developed-by: Alan Brady <[email protected]> Signed-off-by: Alan Brady <[email protected]> Co-developed-by: Madhu Chittim <[email protected]> Signed-off-by: Madhu Chittim <[email protected]> Co-developed-by: Phani Burra <[email protected]> Signed-off-by: Phani Burra <[email protected]> Reviewed-by: Sridhar Samudrala <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Co-developed-by: Pavan Kumar Linga <[email protected]> Signed-off-by: Pavan Kumar Linga <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 3a8845a commit a5ab9ee

File tree

8 files changed

+1290
-31
lines changed

8 files changed

+1290
-31
lines changed

drivers/net/ethernet/intel/idpf/idpf.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct idpf_vport_max_q;
1414
#include <linux/etherdevice.h>
1515
#include <linux/pci.h>
1616
#include <linux/bitfield.h>
17+
#include <linux/sctp.h>
1718
#include <net/gro.h>
1819
#include <linux/dim.h>
1920

@@ -280,6 +281,7 @@ enum idpf_vport_flags {
280281
* @txq_grps: Array of TX queue groups
281282
* @txq_model: Split queue or single queue queuing model
282283
* @txqs: Used only in hotpath to get to the right queue very fast
284+
* @crc_enable: Enable CRC insertion offload
283285
* @num_rxq: Number of allocated RX queues
284286
* @num_bufq: Number of allocated buffer queues
285287
* @rxq_desc_count: RX queue descriptor count. *MUST* have enough descriptors
@@ -326,6 +328,7 @@ struct idpf_vport {
326328
struct idpf_txq_group *txq_grps;
327329
u32 txq_model;
328330
struct idpf_queue **txqs;
331+
bool crc_enable;
329332

330333
u16 num_rxq;
331334
u16 num_bufq;
@@ -534,6 +537,9 @@ struct idpf_vport_config {
534537
* @vc_state: Virtchnl message state
535538
* @vc_msg: Virtchnl message buffer
536539
* @dev_ops: See idpf_dev_ops
540+
* @num_vfs: Number of allocated VFs through sysfs. PF does not directly talk
541+
* to VFs but is used to initialize them
542+
* @crc_enable: Enable CRC insertion offload
537543
* @req_tx_splitq: TX split or single queue model to request
538544
* @req_rx_splitq: RX split or single queue model to request
539545
* @vport_ctrl_lock: Lock to protect the vport control flow
@@ -587,6 +593,8 @@ struct idpf_adapter {
587593
DECLARE_BITMAP(vc_state, IDPF_VC_NBITS);
588594
char vc_msg[IDPF_CTLQ_MAX_BUF_LEN];
589595
struct idpf_dev_ops dev_ops;
596+
int num_vfs;
597+
bool crc_enable;
590598
bool req_tx_splitq;
591599
bool req_rx_splitq;
592600

@@ -848,5 +856,7 @@ int idpf_send_create_vport_msg(struct idpf_adapter *adapter,
848856
struct idpf_vport_max_q *max_q);
849857
int idpf_check_supported_desc_ids(struct idpf_vport *vport);
850858
int idpf_send_map_unmap_queue_vector_msg(struct idpf_vport *vport, bool map);
859+
int idpf_send_set_sriov_vfs_msg(struct idpf_adapter *adapter, u16 num_vfs);
860+
int idpf_sriov_configure(struct pci_dev *pdev, int num_vfs);
851861

852862
#endif /* !_IDPF_H_ */

drivers/net/ethernet/intel/idpf/idpf_lan_txrx.h

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,32 @@ enum idpf_rss_hash {
6464
#define IDPF_TXD_COMPLQ_QID_S 0
6565
#define IDPF_TXD_COMPLQ_QID_M GENMASK_ULL(9, 0)
6666

67+
/* For base mode TX descriptors */
68+
69+
#define IDPF_TXD_CTX_QW0_TUNN_L4T_CS_S 23
70+
#define IDPF_TXD_CTX_QW0_TUNN_L4T_CS_M BIT_ULL(IDPF_TXD_CTX_QW0_TUNN_L4T_CS_S)
71+
#define IDPF_TXD_CTX_QW0_TUNN_DECTTL_S 19
72+
#define IDPF_TXD_CTX_QW0_TUNN_DECTTL_M \
73+
(0xFULL << IDPF_TXD_CTX_QW0_TUNN_DECTTL_S)
74+
#define IDPF_TXD_CTX_QW0_TUNN_NATLEN_S 12
75+
#define IDPF_TXD_CTX_QW0_TUNN_NATLEN_M \
76+
(0X7FULL << IDPF_TXD_CTX_QW0_TUNN_NATLEN_S)
77+
#define IDPF_TXD_CTX_QW0_TUNN_EIP_NOINC_S 11
78+
#define IDPF_TXD_CTX_QW0_TUNN_EIP_NOINC_M \
79+
BIT_ULL(IDPF_TXD_CTX_QW0_TUNN_EIP_NOINC_S)
80+
#define IDPF_TXD_CTX_EIP_NOINC_IPID_CONST \
81+
IDPF_TXD_CTX_QW0_TUNN_EIP_NOINC_M
82+
#define IDPF_TXD_CTX_QW0_TUNN_NATT_S 9
83+
#define IDPF_TXD_CTX_QW0_TUNN_NATT_M (0x3ULL << IDPF_TXD_CTX_QW0_TUNN_NATT_S)
84+
#define IDPF_TXD_CTX_UDP_TUNNELING BIT_ULL(IDPF_TXD_CTX_QW0_TUNN_NATT_S)
85+
#define IDPF_TXD_CTX_GRE_TUNNELING (0x2ULL << IDPF_TXD_CTX_QW0_TUNN_NATT_S)
86+
#define IDPF_TXD_CTX_QW0_TUNN_EXT_IPLEN_S 2
87+
#define IDPF_TXD_CTX_QW0_TUNN_EXT_IPLEN_M \
88+
(0x3FULL << IDPF_TXD_CTX_QW0_TUNN_EXT_IPLEN_S)
89+
#define IDPF_TXD_CTX_QW0_TUNN_EXT_IP_S 0
90+
#define IDPF_TXD_CTX_QW0_TUNN_EXT_IP_M \
91+
(0x3ULL << IDPF_TXD_CTX_QW0_TUNN_EXT_IP_S)
92+
6793
#define IDPF_TXD_CTX_QW1_MSS_S 50
6894
#define IDPF_TXD_CTX_QW1_MSS_M GENMASK_ULL(63, 50)
6995
#define IDPF_TXD_CTX_QW1_TSO_LEN_S 30
@@ -112,6 +138,27 @@ enum idpf_tx_desc_dtype_value {
112138
IDPF_TX_DESC_DTYPE_DESC_DONE = 15,
113139
};
114140

141+
enum idpf_tx_ctx_desc_cmd_bits {
142+
IDPF_TX_CTX_DESC_TSO = 0x01,
143+
IDPF_TX_CTX_DESC_TSYN = 0x02,
144+
IDPF_TX_CTX_DESC_IL2TAG2 = 0x04,
145+
IDPF_TX_CTX_DESC_RSVD = 0x08,
146+
IDPF_TX_CTX_DESC_SWTCH_NOTAG = 0x00,
147+
IDPF_TX_CTX_DESC_SWTCH_UPLINK = 0x10,
148+
IDPF_TX_CTX_DESC_SWTCH_LOCAL = 0x20,
149+
IDPF_TX_CTX_DESC_SWTCH_VSI = 0x30,
150+
IDPF_TX_CTX_DESC_FILT_AU_EN = 0x40,
151+
IDPF_TX_CTX_DESC_FILT_AU_EVICT = 0x80,
152+
IDPF_TX_CTX_DESC_RSVD1 = 0xF00
153+
};
154+
155+
enum idpf_tx_desc_len_fields {
156+
/* Note: These are predefined bit offsets */
157+
IDPF_TX_DESC_LEN_MACLEN_S = 0, /* 7 BITS */
158+
IDPF_TX_DESC_LEN_IPLEN_S = 7, /* 7 BITS */
159+
IDPF_TX_DESC_LEN_L4_LEN_S = 14 /* 4 BITS */
160+
};
161+
115162
enum idpf_tx_base_desc_cmd_bits {
116163
IDPF_TX_DESC_CMD_EOP = BIT(0),
117164
IDPF_TX_DESC_CMD_RS = BIT(1),
@@ -148,6 +195,16 @@ struct idpf_splitq_tx_compl_desc {
148195
u8 rsvd; /* Reserved */
149196
}; /* writeback used with completion queues */
150197

198+
/* Context descriptors */
199+
struct idpf_base_tx_ctx_desc {
200+
struct {
201+
__le32 tunneling_params;
202+
__le16 l2tag2;
203+
__le16 rsvd1;
204+
} qw0;
205+
__le64 qw1; /* type_cmd_tlen_mss/rt_hint */
206+
};
207+
151208
/* Common cmd field defines for all desc except Flex Flow Scheduler (0x0C) */
152209
enum idpf_tx_flex_desc_cmd_bits {
153210
IDPF_TX_FLEX_DESC_CMD_EOP = BIT(0),

drivers/net/ethernet/intel/idpf/idpf_lib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,4 +1565,5 @@ static const struct net_device_ops idpf_netdev_ops_splitq = {
15651565
static const struct net_device_ops idpf_netdev_ops_singleq = {
15661566
.ndo_open = idpf_open,
15671567
.ndo_stop = idpf_stop,
1568+
.ndo_start_xmit = idpf_tx_singleq_start,
15681569
};

drivers/net/ethernet/intel/idpf/idpf_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
133133
break;
134134
case IDPF_DEV_ID_VF:
135135
idpf_vf_dev_ops_init(adapter);
136+
adapter->crc_enable = true;
136137
break;
137138
default:
138139
err = -ENODEV;

0 commit comments

Comments
 (0)