Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

staging: fsl-dpaa2/eth: Use affine DPIO services

Use the newly added DPIO service API to map cpu-affine DPIO services
to channels.

The DPAA2 Ethernet driver already had mappings of frame queues and
channels to cpus, but had no control over the DPIOs used. We can
now ensure full affinity of hotpath hardware resources to cores,
which improves performance and almost eliminates some resource
contentions (e.g. enqueue/dequeue busy counters should be close to
zero from now on).

Making the pull channel operation core affine brings the most
significant benefits. This ensures the same DPIO service will be
used for all dequeue commands issued for a certain frame queue,
which is in line with the way hardware is optimized.

Additionally, we also use affine DPIOs for the frame enqueue and
buffer release operations in order to avoid resource contention.
dpaa2_io_service_register() and dpaa2_io_service_rearm()
functions receive an affine DPIO as argument mostly for uniformity,
but this doesn't change the previous functionality.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ioana Radulescu and committed by
Greg Kroah-Hartman
7ec0596f 1f495383

+15 -10
+14 -10
drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
··· 597 597 queue_mapping = skb_get_queue_mapping(skb); 598 598 fq = &priv->fq[queue_mapping]; 599 599 for (i = 0; i < DPAA2_ETH_ENQUEUE_RETRIES; i++) { 600 - err = dpaa2_io_service_enqueue_qd(NULL, priv->tx_qdid, 0, 600 + err = dpaa2_io_service_enqueue_qd(fq->channel->dpio, 601 + priv->tx_qdid, 0, 601 602 fq->tx_qdbin, &fd); 602 603 if (err != -EBUSY) 603 604 break; ··· 720 719 /* Perform a single release command to add buffers 721 720 * to the specified buffer pool 722 721 */ 723 - static int add_bufs(struct dpaa2_eth_priv *priv, u16 bpid) 722 + static int add_bufs(struct dpaa2_eth_priv *priv, 723 + struct dpaa2_eth_channel *ch, u16 bpid) 724 724 { 725 725 struct device *dev = priv->net_dev->dev.parent; 726 726 u64 buf_array[DPAA2_ETH_BUFS_PER_CMD]; ··· 755 753 756 754 release_bufs: 757 755 /* In case the portal is busy, retry until successful */ 758 - while ((err = dpaa2_io_service_release(NULL, bpid, 756 + while ((err = dpaa2_io_service_release(ch->dpio, bpid, 759 757 buf_array, i)) == -EBUSY) 760 758 cpu_relax(); 761 759 ··· 796 794 for (j = 0; j < priv->num_channels; j++) { 797 795 for (i = 0; i < DPAA2_ETH_NUM_BUFS; 798 796 i += DPAA2_ETH_BUFS_PER_CMD) { 799 - new_count = add_bufs(priv, bpid); 797 + new_count = add_bufs(priv, priv->channel[j], bpid); 800 798 priv->channel[j]->buf_count += new_count; 801 799 802 800 if (new_count < DPAA2_ETH_BUFS_PER_CMD) { ··· 854 852 return 0; 855 853 856 854 do { 857 - new_count = add_bufs(priv, bpid); 855 + new_count = add_bufs(priv, ch, bpid); 858 856 if (unlikely(!new_count)) { 859 857 /* Out of memory; abort for now, we'll try later on */ 860 858 break; ··· 875 873 876 874 /* Retry while portal is busy */ 877 875 do { 878 - err = dpaa2_io_service_pull_channel(NULL, ch->ch_id, ch->store); 876 + err = dpaa2_io_service_pull_channel(ch->dpio, ch->ch_id, 877 + ch->store); 879 878 dequeues++; 880 879 cpu_relax(); 881 880 } while (err == -EBUSY); ··· 926 923 if (cleaned < budget && napi_complete_done(napi, cleaned)) { 927 924 /* Re-enable data available notifications */ 928 925 do { 929 - err = dpaa2_io_service_rearm(NULL, &ch->nctx); 926 + err = dpaa2_io_service_rearm(ch->dpio, &ch->nctx); 930 927 cpu_relax(); 931 928 } while (err == -EBUSY); 932 929 WARN_ONCE(err, "CDAN notifications rearm failed on core %d", ··· 1534 1531 nctx->desired_cpu = i; 1535 1532 1536 1533 /* Register the new context */ 1537 - err = dpaa2_io_service_register(NULL, nctx); 1534 + channel->dpio = dpaa2_io_service_select(i); 1535 + err = dpaa2_io_service_register(channel->dpio, nctx); 1538 1536 if (err) { 1539 1537 dev_dbg(dev, "No affine DPIO for cpu %d\n", i); 1540 1538 /* If no affine DPIO for this core, there's probably ··· 1575 1571 return 0; 1576 1572 1577 1573 err_set_cdan: 1578 - dpaa2_io_service_deregister(NULL, nctx); 1574 + dpaa2_io_service_deregister(channel->dpio, nctx); 1579 1575 err_service_reg: 1580 1576 free_channel(priv, channel); 1581 1577 err_alloc_ch: ··· 1598 1594 /* deregister CDAN notifications and free channels */ 1599 1595 for (i = 0; i < priv->num_channels; i++) { 1600 1596 ch = priv->channel[i]; 1601 - dpaa2_io_service_deregister(NULL, &ch->nctx); 1597 + dpaa2_io_service_deregister(ch->dpio, &ch->nctx); 1602 1598 free_channel(priv, ch); 1603 1599 } 1604 1600 }
+1
drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
··· 288 288 int ch_id; 289 289 int dpio_id; 290 290 struct napi_struct napi; 291 + struct dpaa2_io *dpio; 291 292 struct dpaa2_io_store *store; 292 293 struct dpaa2_eth_priv *priv; 293 294 int buf_count;