enable hairpin queue
cover enable hairpin queue
This patchset enables CPF for Intel Device ID of 0x1453 and supports hairpin queue based on idpf (Infrastructure Data Path Function) PMD [*EXPERIMENTAL*] in DPDK.
This patchset is based on the idpf PMD code:
https://patchwork.dpdk.org/project/dpdk/list/?series=24538&state=*
Junfeng Guo (3):
net/idpf: add support for CPF
net/idpf: add support for hairpin queue net/idpf: adjust RSS LUT to exclude hairpin queue
drivers/net/idpf/base/virtchnl2.h | 6 + drivers/net/idpf/idpf_ethdev.c | 149 +++++++- drivers/net/idpf/idpf_ethdev.h | 5 + drivers/net/idpf/idpf_rxtx.c | 582 +++++++++++++++++++++++++++++- drivers/net/idpf/idpf_rxtx.h | 29 ++ drivers/net/idpf/idpf_vchnl.c | 211 ++++++++--- 6 files changed, 902 insertions(+), 80 deletions(-)
Signature · 1 line
2.25.1
RFC 1/3 net/idpf: add support for CPF
Add CPF device id in idpf map.
--- drivers/net/idpf/idpf_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/idpf/idpf_ethdev.c +1 -0
@@ -1193,6 +1193,7 @@ idpf_dev_uninit(struct rte_eth_dev *dev)static const struct rte_pci_id pci_id_idpf_map[] = { {RTE_PCI_DEVICE (IECM_INTEL_VENDOR_ID ,IECM_DEV_ID_PF ) }, + {RTE_PCI_DEVICE (IECM_INTEL_VENDOR_ID ,IECM_DEV_ID_CPF ) }, { .vendor_id =0 ,/* sentinel */ }, };
Signature · 1 line
2.25.1
v2 cover enable hairpin queue
This patchset enables CPF for Intel Device ID of 0x1453 and supports hairpin queue based on idpf (Infrastructure Data Path Function) PMD [*EXPERIMENTAL*] in DPDK.
This patchset is based on the idpf PMD code:
https://patchwork.dpdk.org/project/dpdk/list/?series=24538&state=*
v2:
fix hairpin queue config sequence issue.
Junfeng Guo (3):
net/idpf: add support for CPF
net/idpf: add support for hairpin queue net/idpf: adjust RSS LUT to exclude hairpin queue
drivers/net/idpf/base/virtchnl2.h | 6 + drivers/net/idpf/idpf_ethdev.c | 206 +++++++++++- drivers/net/idpf/idpf_ethdev.h | 5 + drivers/net/idpf/idpf_rxtx.c | 521 ++++++++++++++++++++++++++++-- drivers/net/idpf/idpf_rxtx.h | 27 ++ drivers/net/idpf/idpf_vchnl.c | 211 +++++++++--- 6 files changed, 896 insertions(+), 80 deletions(-)
Signature · 1 line
2.25.1
RFC v2 1/3 net/idpf: add support for CPF
Add CPF device id in idpf map.
--- drivers/net/idpf/idpf_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/idpf/idpf_ethdev.c +1 -0
@@ -1193,6 +1193,7 @@ idpf_dev_uninit(struct rte_eth_dev *dev)static const struct rte_pci_id pci_id_idpf_map[] = { {RTE_PCI_DEVICE (IECM_INTEL_VENDOR_ID ,IECM_DEV_ID_PF ) }, + {RTE_PCI_DEVICE (IECM_INTEL_VENDOR_ID ,IECM_DEV_ID_CPF ) }, { .vendor_id =0 ,/* sentinel */ }, };
Signature · 1 line
2.25.1
RFC v2 2/3 net/idpf: add support for hairpin queue
In reply to Junfeng Guo- Implement hairpin queue setup/confige/enable/disable.
- Cross-vport hairpin queue implemented via hairpin_bind/unbind API.
Test step:
1. Make sure no bug on CP side.
2. Add rule on IMC.
- devmem 0x202920C100 64 0x804
- opcode=0x1303 prof_id=0x34 sub_prof_id=0x0 cookie=0xa2b87 key=0x18,\
0x0,00,00,00,00,de,0xad,0xbe,0xef,0x20,0x24,0x0,0x0,0x0,0x0,00,00,\
00,00,00,00,0xa,0x2,0x1d,0x64,00,00,00,00,00,00,00,00,00,00,00,00,\
0xa,0x2,0x1d,0x2,00,00,00,00,00,00,00,00,00,00,00,00 act=set_vsi{\
act_val=0 val_type=2 dst_pe=0 slot=0x0} act=set_q{\
qnum=0x142 no_implicit_vsi=1 prec=5}3. Send packets on ixia side
UDP packets with dmac=de:ad:be:ef:20:24 sip=10.2.29.100 dip=10.2.29.2
--- drivers/net/idpf/base/virtchnl2.h | 6 + drivers/net/idpf/idpf_ethdev.c | 181 ++++++++++- drivers/net/idpf/idpf_ethdev.h | 5 + drivers/net/idpf/idpf_rxtx.c | 521 ++++++++++++++++++++++++++++-- drivers/net/idpf/idpf_rxtx.h | 27 ++ drivers/net/idpf/idpf_vchnl.c | 211 +++++++++--- 6 files changed, 871 insertions(+), 80 deletions(-)
drivers/net/idpf/base/virtchnl2.h +6 -0
@@ -273,6 +273,12 @@#define VIRTCHNL2_QUEUE_TYPE_RX_BUFFER 3#define VIRTCHNL2_QUEUE_TYPE_CONFIG_TX 4#define VIRTCHNL2_QUEUE_TYPE_CONFIG_RX 5 +#define VIRTCHNL2_QUEUE_TYPE_P2P_TX 6 +#define VIRTCHNL2_QUEUE_TYPE_P2P_RX 7 +#define VIRTCHNL2_QUEUE_TYPE_P2P_TX_COMPLETION 8 +#define VIRTCHNL2_QUEUE_TYPE_P2P_RX_BUFFER 9 +#define VIRTCHNL2_QUEUE_TYPE_MBX_TX 10 +#define VIRTCHNL2_QUEUE_TYPE_MBX_RX 11/* VIRTCHNL2_ITR_IDX * Virtchannel interrupt throttling rate index
drivers/net/idpf/idpf_ethdev.c +172 -9
229 lines not on this page · raw message
drivers/net/idpf/idpf_ethdev.h +5 -0
@@ -135,6 +135,9 @@ struct idpf_vport {/* Chunk info */ struct idpf_chunks_info chunks_info; +/* p2p mbuf pool */ +struct rte_mempool *p2p_mp; +/* Event from ipf */ bool link_up;uint32_t link_speed;
@@ -256,6 +259,8 @@ int idpf_config_txqs(struct idpf_vport *vport);int idpf_config_txq (struct idpf_vport *vport,uint16_t txq_id);int idpf_switch_queue (struct idpf_vport *vport,uint16_t qid,bool rx,bool on); +int idpf_switch_hairpin_queue (struct idpf_vport *vport,uint16_t qid, +bool rx,bool on);int idpf_ena_dis_queues (struct idpf_vport *vport,bool enable);int idpf_ena_dis_vport (struct idpf_vport *vport,bool enable); int idpf_query_stats(struct idpf_vport *vport,
drivers/net/idpf/idpf_rxtx.c +502 -19
640 lines not on this page · raw message
drivers/net/idpf/idpf_rxtx.h +27 -0
@@ -55,6 +55,7 @@#define IDPF_MIN_RING_DESC 32#define IDPF_MAX_RING_DESC 4096#define IDPF_DMA_MEM_ALIGN 4096 +#define IDPF_P2P_DESC_LEN 16/* Base address of the HW descriptor ring should be 128B aligned. */ #define IDPF_RING_BASE_ALIGN 128
@@ -103,6 +104,11 @@extern uint64_t idpf_timestamp_dynflag; +struct virtchnl2_p2p_rx_buf_desc { +__le64 reserve0; +__le64 pkt_addr;/* Packet buffer address */ +}; +struct idpf_rx_queue {struct idpf_adapter *adapter;/* the adapter this queue belongs to */ struct rte_mempool *mp;/* mbuf pool to populate Rx ring */
@@ -138,6 +144,12 @@ struct idpf_rx_queue {uint16_t max_pkt_len;/* Maximum packet length */ uint8_t crc_len;/* 0 if CRC stripped, 4 otherwise */ uint8_t rxdid; +uint8_t q_type; + +bool hairpin_q;/* if rx queue is a hairpin queue */ +/* only valid if the hairpin queue pair crosses vport */ +bool hairpin_cv; +uint16_t peer_txp;bool q_set;/* if rx queue has been configured */ bool q_started;/* if rx queue has been started */
@@ -186,6 +198,7 @@ struct idpf_tx_queue {uint16_t port_id;uint16_t queue_id; +uint8_t q_type;uint64_t offloads;uint16_t next_dd;/* next to set RS, for VPMD */ uint16_t next_rs;/* next to check DD, for VPMD */
@@ -205,6 +218,14 @@ struct idpf_tx_queue {uint32_t tx_start_qid;uint8_t expected_gen_id;struct idpf_tx_queue *complq; + +/* only valid for hairpin queue */ +bool hairpin_q; +/* only valid if the hairpin queue pair crosses vport */ +bool hairpin_cv; +uint16_t peer_rxq_id; +uint16_t peer_rxp; +bool bound; };/* Offload features */
@@ -242,6 +263,12 @@ int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,int idpf_tx_queue_init (struct rte_eth_dev *dev,uint16_t tx_queue_id);int idpf_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int idpf_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int idpf_rx_hairpin_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +uint16_t nb_desc, +const struct rte_eth_hairpin_conf *conf); +int idpf_tx_hairpin_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +uint16_t nb_desc, +const struct rte_eth_hairpin_conf *conf);void idpf_dev_tx_queue_release (struct rte_eth_dev *dev,uint16_t qid); uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/idpf/idpf_vchnl.c +159 -52
296 lines not on this page · raw message
Signature · 1 line
2.25.1
RFC v2 3/3 net/idpf: adjust RSS LUT to exclude hairpin queue
In reply to Junfeng GuoRSS should direct traffic only to the normal data Rx queues, so when hairpin queue configured, RSS LUT should be adjusted to exclude the hairpin queue.
--- drivers/net/idpf/idpf_ethdev.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/net/idpf/idpf_ethdev.c +24 -0
@@ -624,9 +624,28 @@ idpf_config_rx_queues_irqs(struct rte_eth_dev *dev)return -1 ; } +static int +idpf_config_rss_lut (struct idpf_vport *vport,uint16_t nb_q) +{ +uint16_t lut_size = vport->rss_lut_size; +uint16_t i; +int ret; + +for (i =0 ; i < lut_size; i++) + vport->rss_lut[i] = i % nb_q; + + ret =idpf_set_rss_lut (vport); +if (ret) +PMD_INIT_LOG (ERR ,"Failed to configure RSS lut" ); + +return ret; +} +static int idpf_start_queues (struct rte_eth_dev *dev) { +struct idpf_vport *vport = (struct idpf_vport *)dev->data->dev_private; +uint16_t nb_rxq = dev->data->nb_rx_queues;struct idpf_rx_queue *rxq;struct idpf_tx_queue *txq;int err =0 ;
@@ -704,6 +723,11 @@ idpf_start_queues(struct rte_eth_dev *dev) } } +/* RSS only to the data queues */ + rxq = dev->data->rx_queues[nb_rxq -1 ]; +if (nb_rxq >1 && rxq && rxq->hairpin_q) + err =idpf_config_rss_lut (vport, nb_rxq -1 ); +return err; }
Signature · 1 line
2.25.1
Re: [RFC 1/3] net/idpf: add support for CPF
In reply to Junfeng GuoQuoted 3 lines · On Mon, 5 Sep 2022 19:30:29 +0800 Junfeng Guo <[email protected]> wrote:
Add CPF device id in idpf map.
Signed-off-by Junfeng Guo <[email protected]>
The driver internals have changed since this patch was sent. If it still makes sense, rebase and resubmit.
RFC 2/3 net/idpf: add support for hairpin queue
In reply to Junfeng Guo- Implement hairpin queue setup/confige/enable/disable.
- Cross-vport hairpin queue implemented via hairpin_bind/unbind API.
Test step:
1. Make sure no bug on CP side.
2. Add rule on IMC.
- devmem 0x202920C100 64 0x804
- opcode=0x1303 prof_id=0x34 sub_prof_id=0x0 cookie=0xa2b87 key=0x18,\
0x0,00,00,00,00,de,0xad,0xbe,0xef,0x20,0x24,0x0,0x0,0x0,0x0,00,00,\
00,00,00,00,0xa,0x2,0x1d,0x64,00,00,00,00,00,00,00,00,00,00,00,00,\
0xa,0x2,0x1d,0x2,00,00,00,00,00,00,00,00,00,00,00,00 act=set_vsi{\
act_val=0 val_type=2 dst_pe=0 slot=0x0} act=set_q{\
qnum=0x142 no_implicit_vsi=1 prec=5}3. Send packets on ixia side
UDP packets with dmac=de:ad:be:ef:20:24 sip=10.2.29.100 dip=10.2.29.2
--- drivers/net/idpf/base/virtchnl2.h | 6 + drivers/net/idpf/idpf_ethdev.c | 124 ++++++- drivers/net/idpf/idpf_ethdev.h | 5 + drivers/net/idpf/idpf_rxtx.c | 582 +++++++++++++++++++++++++++++- drivers/net/idpf/idpf_rxtx.h | 29 ++ drivers/net/idpf/idpf_vchnl.c | 211 ++++++++--- 6 files changed, 877 insertions(+), 80 deletions(-)
drivers/net/idpf/base/virtchnl2.h +6 -0
@@ -273,6 +273,12 @@#define VIRTCHNL2_QUEUE_TYPE_RX_BUFFER 3#define VIRTCHNL2_QUEUE_TYPE_CONFIG_TX 4#define VIRTCHNL2_QUEUE_TYPE_CONFIG_RX 5 +#define VIRTCHNL2_QUEUE_TYPE_P2P_TX 6 +#define VIRTCHNL2_QUEUE_TYPE_P2P_RX 7 +#define VIRTCHNL2_QUEUE_TYPE_P2P_TX_COMPLETION 8 +#define VIRTCHNL2_QUEUE_TYPE_P2P_RX_BUFFER 9 +#define VIRTCHNL2_QUEUE_TYPE_MBX_TX 10 +#define VIRTCHNL2_QUEUE_TYPE_MBX_RX 11/* VIRTCHNL2_ITR_IDX * Virtchannel interrupt throttling rate index
drivers/net/idpf/idpf_ethdev.c +115 -9
168 lines not on this page · raw message
drivers/net/idpf/idpf_ethdev.h +5 -0
@@ -135,6 +135,9 @@ struct idpf_vport {/* Chunk info */ struct idpf_chunks_info chunks_info; +/* p2p mbuf pool */ +struct rte_mempool *p2p_mp; +/* Event from ipf */ bool link_up;uint32_t link_speed;
@@ -256,6 +259,8 @@ int idpf_config_txqs(struct idpf_vport *vport);int idpf_config_txq (struct idpf_vport *vport,uint16_t txq_id);int idpf_switch_queue (struct idpf_vport *vport,uint16_t qid,bool rx,bool on); +int idpf_switch_hairpin_queue (struct idpf_vport *vport,uint16_t qid, +bool rx,bool on);int idpf_ena_dis_queues (struct idpf_vport *vport,bool enable);int idpf_ena_dis_vport (struct idpf_vport *vport,bool enable); int idpf_query_stats(struct idpf_vport *vport,
drivers/net/idpf/idpf_rxtx.c +563 -19
713 lines not on this page · raw message
drivers/net/idpf/idpf_rxtx.h +29 -0
@@ -55,6 +55,7 @@#define IDPF_MIN_RING_DESC 32#define IDPF_MAX_RING_DESC 4096#define IDPF_DMA_MEM_ALIGN 4096 +#define IDPF_P2P_DESC_LEN 16/* Base address of the HW descriptor ring should be 128B aligned. */ #define IDPF_RING_BASE_ALIGN 128
@@ -103,6 +104,11 @@extern uint64_t idpf_timestamp_dynflag; +struct virtchnl2_p2p_rx_buf_desc { +__le64 reserve0; +__le64 pkt_addr;/* Packet buffer address */ +}; +struct idpf_rx_queue {struct idpf_adapter *adapter;/* the adapter this queue belongs to */ struct rte_mempool *mp;/* mbuf pool to populate Rx ring */
@@ -138,6 +144,12 @@ struct idpf_rx_queue {uint16_t max_pkt_len;/* Maximum packet length */ uint8_t crc_len;/* 0 if CRC stripped, 4 otherwise */ uint8_t rxdid; +uint8_t q_type; + +bool hairpin_q;/* if rx queue is a hairpin queue */ +/* only valid if the hairpin queue pair crosses vport */ +bool hairpin_cv; +uint16_t peer_txp;bool q_set;/* if rx queue has been configured */ bool q_started;/* if rx queue has been started */
@@ -186,6 +198,7 @@ struct idpf_tx_queue {uint16_t port_id;uint16_t queue_id; +uint8_t q_type;uint64_t offloads;uint16_t next_dd;/* next to set RS, for VPMD */ uint16_t next_rs;/* next to check DD, for VPMD */
@@ -205,6 +218,14 @@ struct idpf_tx_queue {uint32_t tx_start_qid;uint8_t expected_gen_id;struct idpf_tx_queue *complq; + +/* only valid for hairpin queue */ +bool hairpin_q; +/* only valid if the hairpin queue pair crosses vport */ +bool hairpin_cv; +uint16_t peer_rxq_id; +uint16_t peer_rxp; +bool bound; };/* Offload features */
@@ -233,6 +254,7 @@ int idpf_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, struct rte_mempool *mp);int idpf_rx_queue_init (struct rte_eth_dev *dev,uint16_t rx_queue_id);int idpf_rx_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id); +int idpf_rx_hairpin_queue_start (struct rte_eth_dev *dev,uint16_t rx_queue_id);int idpf_rx_queue_stop (struct rte_eth_dev *dev,uint16_t rx_queue_id);void idpf_dev_rx_queue_release (struct rte_eth_dev *dev,uint16_t qid);
@@ -241,7 +263,14 @@ int idpf_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, const struct rte_eth_txconf *tx_conf);int idpf_tx_queue_init (struct rte_eth_dev *dev,uint16_t tx_queue_id);int idpf_tx_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int idpf_tx_hairpin_queue_start (struct rte_eth_dev *dev,uint16_t tx_queue_id);int idpf_tx_queue_stop (struct rte_eth_dev *dev,uint16_t tx_queue_id); +int idpf_rx_hairpin_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +uint16_t nb_desc, +const struct rte_eth_hairpin_conf *conf); +int idpf_tx_hairpin_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +uint16_t nb_desc, +const struct rte_eth_hairpin_conf *conf);void idpf_dev_tx_queue_release (struct rte_eth_dev *dev,uint16_t qid); uint16_t idpf_singleq_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
drivers/net/idpf/idpf_vchnl.c +159 -52
296 lines not on this page · raw message
Signature · 1 line
2.25.1
RFC 3/3 net/idpf: adjust RSS LUT to exclude hairpin queue
In reply to Junfeng GuoRSS should direct traffic only to the normal data Rx queues, so when hairpin queue configured, RSS LUT should be adjusted to exclude the hairpin queue.
--- drivers/net/idpf/idpf_ethdev.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/net/idpf/idpf_ethdev.c +24 -0
@@ -625,9 +625,28 @@ idpf_config_rx_queues_irqs(struct rte_eth_dev *dev)return -1 ; } +static int +idpf_config_rss_lut (struct idpf_vport *vport,uint16_t nb_q) +{ +uint16_t lut_size = vport->rss_lut_size; +uint16_t i; +int ret; + +for (i =0 ; i < lut_size; i++) + vport->rss_lut[i] = i % nb_q; + + ret =idpf_set_rss_lut (vport); +if (ret) +PMD_INIT_LOG (ERR ,"Failed to configure RSS lut" ); + +return ret; +} +static int idpf_start_queues (struct rte_eth_dev *dev) { +struct idpf_vport *vport = (struct idpf_vport *)dev->data->dev_private; +uint16_t nb_rxq = dev->data->nb_rx_queues;struct idpf_rx_queue *rxq;struct idpf_tx_queue *txq;int err =0 ;
@@ -671,6 +690,11 @@ idpf_start_queues(struct rte_eth_dev *dev) } } +/* RSS only to the data queues */ + rxq = dev->data->rx_queues[nb_rxq -1 ]; +if (nb_rxq >1 && rxq && rxq->hairpin_q) + err =idpf_config_rss_lut (vport, nb_rxq -1 ); +return err; }
Signature · 1 line
2.25.1