AF_XDP tx halt fix, IRQ pinning and unaligned chunks
cover AF_XDP tx halt fix, IRQ pinning and unaligned chunks
This series contains 3 patches for the AF_XDP PMD.
They were originally independent patches but are now rolled into this series together.
Patch 1: fix Tx halt when no recv packets (Xiaolong Ye) Previous (v1): http://patches.dpdk.org/patch/59044/
Patch 2: support pinning of IRQs
Previous (v1): http://patches.dpdk.org/patch/58571/
v2:
* Update docs with example usage
* Split configure_irqs into multiple smaller functions
* Use /sys/class/net/<iface>/device/driver to get driver string
* Implement lookup mechanism for /proc/interrupts string formatting
* Use /sys/class/net/<iface> symlink to get pci addr for mlx5
Patch 3: enable support for unaligned umem chunks Previous (v2): http://patches.dpdk.org/patch/58624/
v3:
* Fix inconsistent reserve/submit for fill and tx queue addrs
* Improve readability by extracting out functions
* Coding style fixes
The performance of the v3 was measured to be within 5% of the previous zero copy implementation for test cases using a single PMD. For test cases using multiple PMDs the following performance improvement was measured:
ports nics pinned Δ old zc 2 2 0 95.21% 2 2 1 211.23% 2 1 0 88.36% 2 1 1 122.86%
Ciara Loftus (2):
net/af_xdp: support pinning of IRQs net/af_xdp: enable support for unaligned umem chunks
Xiaolong Ye (1):
net/af_xdp: fix Tx halt when no recv packets
doc/guides/nics/af_xdp.rst | 17 +- doc/guides/rel_notes/release_19_11.rst | 11 + drivers/net/af_xdp/rte_eth_af_xdp.c | 744 ++++++++++++++++++++++--- 3 files changed, 685 insertions(+), 87 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/3 net/af_xdp: fix Tx halt when no recv packets
From: Xiaolong Ye <[email protected]>
The kernel only consumes Tx packets if we have some Rx traffic on specified queue or we have called send(). So we need to issue a send() even when the allocation fails so that kernel will start to consume packets again.
Commit 45bba02c95b0 ("net/af_xdp: support need wakeup feature") breaks above rule by adding some condition to send, this patch fixes it while still keeps the need_wakeup feature for Tx.
--- drivers/net/af_xdp/rte_eth_af_xdp.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +14 -14
@@ -286,19 +286,16 @@ kick_tx(struct pkt_tx_queue *txq) {struct xsk_umem_info *umem = txq->pair->umem; -#if defined(XDP_USE_NEED_WAKEUP ) - if (xsk_ring_prod__needs_wakeup(&txq->tx)) -#endif -while (send (xsk_socket__fd (txq->pair->xsk),NULL , -0 ,MSG_DONTWAIT ) <0 ) { -/* some thing unexpected */ -if (errno !=EBUSY && errno !=EAGAIN && errno !=EINTR ) -break ; - -/* pull from completion queue to leave more space */ -if (errno ==EAGAIN ) -pull_umem_cq (umem,ETH_AF_XDP_TX_BATCH_SIZE ); - } +while (send (xsk_socket__fd (txq->pair->xsk),NULL , +0 ,MSG_DONTWAIT ) <0 ) { +/* some thing unexpected */ +if (errno !=EBUSY && errno !=EAGAIN && errno !=EINTR ) +break ; + +/* pull from completion queue to leave more space */ +if (errno ==EAGAIN ) +pull_umem_cq (umem,ETH_AF_XDP_TX_BATCH_SIZE ); + }pull_umem_cq (umem,ETH_AF_XDP_TX_BATCH_SIZE ); }
@@ -367,7 +364,10 @@ eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)xsk_ring_prod__submit (&txq->tx, nb_pkts); -kick_tx (txq); +#if defined(XDP_USE_NEED_WAKEUP ) + if (xsk_ring_prod__needs_wakeup(&txq->tx)) +#endif +kick_tx (txq); txq->stats.tx_pkts += nb_pkts; txq->stats.tx_bytes += tx_bytes;
Signature · 1 line
2.17.1
PATCH 2/3 net/af_xdp: support pinning of IRQs
In reply to Ciara LoftusNetwork devices using the AF_XDP PMD will trigger interrupts on reception of packets. The new PMD argument 'queue_irq' allows the user to specify a core on which to pin interrupts for a given queue. Multiple queue_irq arguments can be specified. For example:
--vdev=net_af_xdp1,iface=eth0,queue_count=2,
queue_irq=0:2,queue_irq=1:5
..will pin queue 0 interrupts to core 2 and queue 1 interrupts to core 5.
The queue argument refers to the ethdev queue as opposed to the netdev queue. These values are the same unless a value greater than 0 is specified in a start_queue argument.
The drivers supported for this feature are those with support for AF_XDP zero copy in the kernel, namely ixgbe, i40e and mlx5_core.
--- doc/guides/nics/af_xdp.rst | 15 ++ doc/guides/rel_notes/release_19_11.rst | 7 + drivers/net/af_xdp/rte_eth_af_xdp.c | 357 ++++++++++++++++++++++++- 3 files changed, 374 insertions(+), 5 deletions(-)
doc/guides/nics/af_xdp.rst +15 -0
@@ -36,6 +36,11 @@ The following options can be provided to set up an af_xdp port in DPDK. * ``start_queue`` - starting netdev queue id (optional, default 0); * ``queue_count`` - total netdev queue number (optional, default 1); * ``pmd_zero_copy`` - enable zero copy or not (optional, default 0); +* ``queue_irq`` - pin queue irqs to specified core <queue:core> (optional, + default no pinning). The queue argument refers to the ethdev queue as + opposed to the netdev queue. These values are the same unless a value + greater than 0 is specified for start_queue. ixgbe, i40e and mlx5 drivers + supported; Prerequisites -------------
@@ -57,3 +62,13 @@ The following example will set up an af_xdp interface in DPDK: .. code-block:: console --vdev net_af_xdp,iface=ens786f1 + +Pin queue IRQs +-------------- +The following example will pin queue 0 interrupts to core 2 and queue 1 +interrupts to core 5. + +.. code-block:: console + + --vdev=net_af_xdp1,iface=eth0,queue_count=2, + queue_irq=0:2,queue_irq=1:5
doc/guides/rel_notes/release_19_11.rst +7 -0
@@ -56,6 +56,13 @@ New Features Also, make sure to start the actual text at the margin. ========================================================= +* **Updated the AF_XDP PMD.** + + Updated the AF_XDP PMD. The new features include: + + * Support for pinning netdev queue IRQs to cores specified by the user. + Available for ixgbe, i40e and mlx5 drivers. + Removed Items -------------
drivers/net/af_xdp/rte_eth_af_xdp.c +352 -5
465 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 2/3] net/af_xdp: support pinning of IRQs
On 09/19, Ciara Loftus wrote:
[snip]
drivers/net/af_xdp/rte_eth_af_xdp.c static const struct rte_eth_link pmd_link = { · line 155
Quoted 2 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +2
-0+/* drivers supported for the queue_irq option */ +enum {I40E_DRIVER ,IXGBE_DRIVER ,MLX5_DRIVER ,NUM_DRIVERS };
Minor nit, how about using below format for readability and align with other enum type definition in DPDK?
enum supported_driver {
I40E_DRIVER,
IXGBE_DRIVER,
MLX5_DRIVER,
NUM_DRIVERS
};Quoted 1 line
+char driver_array[NUM_DRIVERS][NAME_MAX] = {"i40e", "ixgbe", "
mlx5_core"};
[snip]
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 801
Quoted 5 lines
+ * function for getting the index into
driver_handlersarray that corresponds
+ * to 'driver'
+ */drivers/net/af_xdp/rte_eth_af_xdp.c +2
-0+static int +get_driver_idx (char *driver)
const char *driver
Quoted 4 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +4
-0+{ +for (int i =0 ; i <NUM_DRIVERS ; i++) { +if (strncmp (driver, driver_array[i],strlen (driver_array[i]))) +continue ;
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 815
Quoted 10 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +10
-0+return i; + } + +return -1 ; +} + +/** generate /proc/interrupts search regex based on driver type */ +static int +generate_search_regex (const char *driver,struct pmd_internals *internals, +uint16_t netdev_qid,regex_t *r)
I'd prefer put *internals as the first parameter.
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 820
Quoted 5 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +5
-0+{ +char iface_regex_str[128 ]; +int ret =-1 ; +char *driver_dup =strdup (driver); +int idx =get_driver_idx (driver_dup);
Why not using driver directly?
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 832
Quoted 12 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +12
-0+ +if (idx ==-1 ) { +AF_XDP_LOG (ERR ,"Error getting driver index for %s\n" , + internals->if_name); + goto out; + } + +if (driver_handlers[idx](iface_regex_str, internals, netdev_qid)) { +AF_XDP_LOG (ERR ,"Error getting regex string for %s\n" , + internals->if_name); + goto out; + }
Need to check whether driver_handlers[idex] exists.
Quoted 7 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +7
-0+ +if (regcomp (r, iface_regex_str,0 )) { +AF_XDP_LOG (ERR ,"Error computing regex %s\n" , iface_regex_str); + goto out; + } + + ret =0 ;
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 849
Quoted 10 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +10
-0+ +out: +free (driver_dup); +return ret; +} + +/** get interrupt number associated with the given interface qid */ +static int +get_interrupt_number (regex_t *r,int *interrupt, +struct pmd_internals *internals)
Better to put the input before output in parameter list, I'd prefer
get_interrupt_number(struct pmd_internals *internals,
regex_t *r, int *interrupt)
Quoted 29 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +29
-0+{ +FILE *f_int_proc; +int found =0 ; +char line[4096 ]; +int ret =0 ; + + f_int_proc =fopen ("/proc/interrupts" ,"r" ); +if (f_int_proc ==NULL ) { +AF_XDP_LOG (ERR ,"Failed to open /proc/interrupts.\n" ); +return -1 ; + } + +while (!feof (f_int_proc) && !found) { +/* Make sure to read a full line at a time */ +if (fgets (line,sizeof (line), f_int_proc) ==NULL || + line[strlen (line) -1 ] !='\n' ) { +AF_XDP_LOG (ERR ,"Error reading from interrupts file\n" ); + ret =-1 ; +break ; + } + +/* Extract interrupt number from line */ +if (regexec (r, line,0 ,NULL ,0 ) ==0 ) { + *interrupt =atoi (line); + found = true; +AF_XDP_LOG (INFO ,"Got interrupt %d for %s\n" , + *interrupt, internals->if_name); + } + }
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 888
Quoted 10 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +10
-0+ +fclose (f_int_proc); + +return ret; +} + +/** affinitise interrupts for the given qid to the given coreid */ +static int +set_irq_affinity (int coreid,struct pmd_internals *internals, +uint16_t rx_queue_id,uint16_t netdev_qid,int interrupt)
Prefer to put *internals in the beginning.
Quoted 10 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +10
-0+{ +char bitmask[128 ]; +char smp_affinity_filename[NAME_MAX ]; +FILE *f_int_smp_affinity; +int i; + +/* Create affinity bitmask. Every 32 bits are separated by a comma */ +snprintf (bitmask,sizeof (bitmask),"%x" ,1 << (coreid %32 )); +for (i =0 ; i < coreid /32 ; i++) +strlcat (bitmask,",00000000" ,sizeof (bitmask));
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 908
Quoted 10 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +10
-0+ +/* Write the new affinity bitmask */ +snprintf (smp_affinity_filename,sizeof (smp_affinity_filename), +"/proc/irq/%d/smp_affinity" , interrupt); + f_int_smp_affinity =fopen (smp_affinity_filename,"w" ); +if (f_int_smp_affinity ==NULL ) { +AF_XDP_LOG (ERR ,"Error opening %s\n" , smp_affinity_filename); +return -1 ; + } +fwrite (bitmask,strlen (bitmask),1 , f_int_smp_affinity);
Need to check the return value of fwrite, otherwise coverity may complain.
Quoted 16 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +16
-0+fclose (f_int_smp_affinity); +AF_XDP_LOG (INFO ,"IRQs for %s ethdev queue %i (netdev queue %i)" +" affinitised to core %i\n" , + internals->if_name, rx_queue_id, + netdev_qid, coreid); + +return 0 ; +} + +static void +configure_irqs (struct pmd_internals *internals,uint16_t rx_queue_id) +{ +int coreid = internals->queue_irqs[rx_queue_id]; +char driver[NAME_MAX ]; +uint16_t netdev_qid = rx_queue_id + internals->start_queue_idx; +regex_t r;
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 934
Quoted 10 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +10
-0+int interrupt; + +if (coreid <0 ) +return ; + +if (coreid > (get_nprocs () -1 )) { +AF_XDP_LOG (ERR ,"Affinitisation failed - invalid coreid %i\n" , + coreid); +return ; + }
I think we can combine above 2 sanity checks together.
Quoted 112 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +27
-0+ +if (get_driver_name (internals, driver)) { +AF_XDP_LOG (ERR ,"Error retrieving driver name for %s\n" , + internals->if_name); +return ; + } + +if (generate_search_regex (driver, internals, netdev_qid, &r)) { +AF_XDP_LOG (ERR ,"Error generating search regex for %s\n" , + internals->if_name); +return ; + } + +if (get_interrupt_number (&r, &interrupt, internals)) { +AF_XDP_LOG (ERR ,"Error getting interrupt number for %s\n" , + internals->if_name); +return ; + } + +if (set_irq_affinity (coreid, internals, rx_queue_id, netdev_qid, + interrupt)) { +AF_XDP_LOG (ERR ,"Error setting interrupt affinity for %s\n" , + internals->if_name); +return ; + } +} +static int
eth_rx_queue_setup(structrte_eth_dev*dev,uint16_t rx_queue_id,drivers/net/af_xdp/rte_eth_af_xdp.c +35
-0@@ -697,6 +996,8 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, goto err; } +configure_irqs (internals, rx_queue_id); + rxq->fds[0 ].fd =xsk_socket__fd (rxq->xsk); rxq->fds[0 ].events =POLLIN ;@@ -834,6 +1135,39 @@ parse_name_arg(const char *key __rte_unused,return 0 ; } +/** parse queue irq argument */ +static int +parse_queue_irq_arg(const char *key __rte_unused, +const char *value,void *extra_args) +{ +int (*queue_irqs)[RTE_MAX_QUEUES_PER_PORT ] = extra_args; +char *parse_str =strdup (value); +char delimiter[] =":" ; +char *queue_str; + + queue_str =strtok (parse_str, delimiter); +if (queue_str !=NULL &&strncmp (queue_str, value,strlen (value))) { +char *end; +long queue =strtol (queue_str, &end,10 ); + +if (*end =='\0' && queue >=0 && + queue <RTE_MAX_QUEUES_PER_PORT ) { +char *core_str =strtok (NULL , delimiter); +long core =strtol (core_str, &end,10 ); + +if (*end =='\0' && core >=0 && core <get_nprocs ()) { + (*queue_irqs)[queue] = core; +free (parse_str); +return 0 ; + } + } + } + +AF_XDP_LOG (ERR ,"Invalid queue_irq argument.\n" ); +free (parse_str); +return -1 ; +} +static int
xdp_get_channels_info(const char*if_name, int*max_queues,
int*combined_queues)(quoted diff) +0
-0@@ -877,7 +1211,8 @@ xdp_get_channels_info(const char *if_name, int *max_queues,static int
parse_parameters(structrte_kvargs*kvlist, char*if_name, int*start_queue,drivers/net/af_xdp/rte_eth_af_xdp.c +2
-1- int *queue_cnt, int *pmd_zc) + int *queue_cnt, int *pmd_zc, + int (*queue_irqs)[RTE_MAX_QUEUES_PER_PORT]){ int ret;drivers/net/af_xdp/rte_eth_af_xdp.c +5
-0@@ -903,6 +1238,11 @@ parse_parameters(struct rte_kvargs *kvlist, char *if_name, int *start_queue,if (ret <0 ) goto free_kvlist; + ret =rte_kvargs_process (kvlist,ETH_AF_XDP_QUEUE_IRQ_ARG , + &parse_queue_irq_arg, queue_irqs); +if (ret <0 ) + goto free_kvlist; +
free_kvlist:rte_kvargs_free(kvlist); return ret;(quoted diff) +0
-0@@ -940,7 +1280,8 @@ get_iface_info(const char *if_name,static struct
rte_eth_dev*
init_internals(structrte_vdev_device*dev, const char*if_name,drivers/net/af_xdp/rte_eth_af_xdp.c +2
-1- int start_queue_idx, int queue_cnt, int pmd_zc) + int start_queue_idx, int queue_cnt, int pmd_zc, + int queue_irqs[RTE_MAX_QUEUES_PER_PORT]){ const char *name = rte_vdev_device_name(dev); const unsigned int numa_node = dev->device.numa_node;
drivers/net/af_xdp/rte_eth_af_xdp.c init_internals(struct rte_vdev_device *dev, const char *if_name, · line 1301
Quoted 4 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +1
-0@@ -957,6 +1298,8 @@ init_internals(struct rte_vdev_device *dev, const char *if_name, internals->queue_cnt = queue_cnt; internals->pmd_zc = pmd_zc;strlcpy (internals->if_name, if_name,IFNAMSIZ ); + memcpy(internals->queue_irqs, queue_irqs,
Use rte_memcpy instead.
Thanks,
Xiaolong
Quoted 45 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +8
-3+ sizeof(int) * RTE_MAX_QUEUES_PER_PORT);if (xdp_get_channels_info (if_name, &internals->max_queue_cnt, &internals->combined_queue_cnt)) {@@ -1035,6 +1378,9 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)struct rte_eth_dev *eth_dev =NULL ;const char *name;int pmd_zc =0 ; +int queue_irqs[RTE_MAX_QUEUES_PER_PORT ]; + +memset (queue_irqs,-1 ,sizeof (int ) *RTE_MAX_QUEUES_PER_PORT );AF_XDP_LOG (INFO ,"Initializing pmd_af_xdp for %s\n" ,rte_vdev_device_name (dev));@@ -1062,7 +1408,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev) dev->device.numa_node =rte_socket_id ();if (parse_parameters (kvlist, if_name, &xsk_start_queue_idx, - &xsk_queue_cnt, &pmd_zc) <0 ) { + &xsk_queue_cnt, &pmd_zc, &queue_irqs) <0 ) {AF_XDP_LOG (ERR ,"Invalid kvargs value\n" );return -EINVAL ; }@@ -1073,7 +1419,7 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev) } eth_dev =init_internals (dev, if_name, xsk_start_queue_idx, - xsk_queue_cnt, pmd_zc); + xsk_queue_cnt, pmd_zc, queue_irqs);if (eth_dev ==NULL ) {AF_XDP_LOG (ERR ,"Failed to init internals\n" );return -1 ;@@ -1117,7 +1463,8 @@ RTE_PMD_REGISTER_PARAM_STRING(net_af_xdp,"iface=<string> " "start_queue=<int> " "queue_count=<int> " - "pmd_zero_copy=<0|1>"); +"pmd_zero_copy=<0|1> " + "queue_irq=<int>:<int>");RTE_INIT (af_xdp_init_log) {Signature · 1 line
2.17.1
Re: [dpdk-dev] [PATCH 2/3] net/af_xdp: support pinning of IRQs
[snip]
Quoted 12 lines
Quoted 12 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +12
-0+ +static void +configure_irqs (struct pmd_internals *internals,uint16_t rx_queue_id) +{ +int coreid = internals->queue_irqs[rx_queue_id]; +char driver[NAME_MAX ]; +uint16_t netdev_qid = rx_queue_id + internals->start_queue_idx; +regex_t r; +int interrupt; + +if (coreid <0 ) +return ;
Quoted 9 lines
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 934
Quoted 6 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +6
-0+ +if (coreid > (get_nprocs () -1 )) { +AF_XDP_LOG (ERR ,"Affinitisation failed - invalid coreid %i\n" , + coreid); +return ; + }I think we can combine above 2 sanity checks together.
Hi Xiaolong,
Thanks for your review. I agree with all of your feedback except this one.
configure_irqs() is called for every queue. The queues with no affinity have a coreid initialized to -1. So coreid < 0 is a valid value and we should return with no error. However for the case where coreid > nprocs, this is an actual error and we should report that with a log. What do you think?
Thanks,
Ciara
[snip]
Quoted 13 lines
Quoted 13 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +2
-0@@ -697,6 +996,8 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, goto err; } +configure_irqs (internals, rx_queue_id); + rxq->fds[0 ].fd =xsk_socket__fd (rxq->xsk); rxq->fds[0 ].events =POLLIN ;@@ -834,6 +1135,39 @@ parse_name_arg(const char *key __rte_unused,return 0 ; }
Re: [dpdk-dev] [PATCH 2/3] net/af_xdp: support pinning of IRQs
Quoted 24 lines · Ciara
[snip]
Quoted 12 lines
Quoted 12 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +12
-0+ +static void +configure_irqs (struct pmd_internals *internals,uint16_t rx_queue_id) +{ +int coreid = internals->queue_irqs[rx_queue_id]; +char driver[NAME_MAX ]; +uint16_t netdev_qid = rx_queue_id + internals->start_queue_idx; +regex_t r; +int interrupt; + +if (coreid <0 ) +return ;Quoted 9 lines
drivers/net/af_xdp/rte_eth_af_xdp.c xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, · line 934
Quoted 6 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +6
-0+ +if (coreid > (get_nprocs () -1 )) { +AF_XDP_LOG (ERR ,"Affinitisation failed - invalid coreid %i\n" , + coreid); +return ; + }I think we can combine above 2 sanity checks together.
Quoted 6 lines
Hi Xiaolong,
Thanks for your review. I agree with all of your feedback except this one.
configure_irqs()is called for every queue. The queues with no affinity have a coreid initialized to -1. So coreid < 0 is a valid value and we should return with no error. However for the case where coreid > nprocs, this is an actual error and we should report that with a log. What do you think?
It makes sense, thanks for the explanation.
Thanks,
Xiaolong
Quoted 20 lines
Thanks,
Ciara[snip]
Quoted 13 lines
Quoted 13 lines
drivers/net/af_xdp/rte_eth_af_xdp.c +2
-0@@ -697,6 +996,8 @@ eth_rx_queue_setup(struct rte_eth_dev *dev, goto err; } +configure_irqs (internals, rx_queue_id); + rxq->fds[0 ].fd =xsk_socket__fd (rxq->xsk); rxq->fds[0 ].events =POLLIN ;@@ -834,6 +1135,39 @@ parse_name_arg(const char *key __rte_unused,return 0 ; }
Re: [dpdk-dev] [PATCH 2/3] net/af_xdp: support pinning of IRQs
In reply to Ciara LoftusQuoted 1 line · On Thu, 19 Sep 2019 14:15:19 +0000 Ciara Loftus <[email protected]> wrote:
+char driver_array[NUM_DRIVERS][NAME_MAX] = {"i40e", "ixgbe", "
mlx5_core"};
This only makes sense in this file. Should be static.
PATCH 3/3 net/af_xdp: enable support for unaligned umem chunks
In reply to Ciara LoftusThis patch enables the unaligned chunks feature for AF_XDP which allows chunks to be placed at arbitrary places in the umem, as opposed to them being required to be aligned to 2k. This allows for DPDK application mempools to be mapped directly into the umem and in turn enable zero copy transfer between umem and the PMD.
This patch replaces the zero copy via external mbuf mechanism introduced in commit e9ff8bb71943 ("net/af_xdp: enable zero copy by external mbuf"). The pmd_zero copy vdev argument is also removed as now the PMD will auto-detect presence of the unaligned chunks feature and enable it if so and otherwise fall back to copy mode if not detected.
--- doc/guides/nics/af_xdp.rst | 2 +- doc/guides/rel_notes/release_19_11.rst | 4 + drivers/net/af_xdp/rte_eth_af_xdp.c | 375 ++++++++++++++++++++----- 3 files changed, 305 insertions(+), 76 deletions(-)
doc/guides/nics/af_xdp.rst +1 -1
@@ -35,7 +35,6 @@ The following options can be provided to set up an af_xdp port in DPDK. * ``iface`` - name of the Kernel interface to attach to (required); * ``start_queue`` - starting netdev queue id (optional, default 0); * ``queue_count`` - total netdev queue number (optional, default 1); -* ``pmd_zero_copy`` - enable zero copy or not (optional, default 0); * ``queue_irq`` - pin queue irqs to specified core <queue:core> (optional, default no pinning). The queue argument refers to the ethdev queue as opposed to the netdev queue. These values are the same unless a value
@@ -53,6 +52,7 @@ This is a Linux-specific PMD, thus the following prerequisites apply: <kernel src tree>/tools/lib/bpf; * A Kernel bound interface to attach to; * For need_wakeup feature, it requires kernel version later than v5.3-rc1; +* For PMD zero copy, it requires kernel version later than v5.4-rc1; Set up an af_xdp interface -----------------------------
doc/guides/rel_notes/release_19_11.rst +4 -0
@@ -62,6 +62,8 @@ New Features * Support for pinning netdev queue IRQs to cores specified by the user. Available for ixgbe, i40e and mlx5 drivers. + * Enabled zero copy between application mempools and UMEM by enabling the + XDP_UMEM_UNALIGNED_CHUNKS UMEM flag. Removed Items
@@ -85,6 +87,8 @@ Removed Items "port config <port_id> rx_offload crc_strip|scatter|ipv4_cksum|udp_cksum|tcp_cksum| timestamp|vlan_strip|vlan_filter|vlan_extend on|off" + * Removed AF_XDP pmd_zero copy vdev argument. Support is now auto-detected. + API Changes -----------
drivers/net/af_xdp/rte_eth_af_xdp.c +300 -75
624 lines not on this page · raw message
Signature · 1 line
2.17.1