DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Sanford, Robert" <rsanford@akamai.com>
To: Declan Doherty <declan.doherty@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 2/6] bond: removing switch statement from rx burst method
Date: Wed, 20 Aug 2014 15:25:15 -0500	[thread overview]
Message-ID: <D01A7C4F.27B7%rsanford@akamai.com> (raw)
In-Reply-To: <1408456313-28812-3-git-send-email-declan.doherty@intel.com>

Reviewed-by: Robert Sanford <rsanford@akamai.com>


>Splitting rx burst function into seperate functions to avoid the need for
>a switch statement and also to match the structure of the tx burst
>functions.
>
>Signed-off-by: Declan Doherty <declan.doherty@intel.com>
>---
> lib/librte_pmd_bond/rte_eth_bond_pmd.c |   62
>++++++++++++++++++--------------
> 1 files changed, 35 insertions(+), 27 deletions(-)
>
>diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
>b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
>index cd3eecf..683b146 100644
>--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
>+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
>@@ -59,33 +59,37 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf
>**bufs, uint16_t nb_pkts)
> 
> 	internals = bd_rx_q->dev_private;
> 
>-	switch (internals->mode) {
>-	case BONDING_MODE_ROUND_ROBIN:
>-	case BONDING_MODE_BROADCAST:
>-	case BONDING_MODE_BALANCE:
>-		for (i = 0; i < internals->active_slave_count && nb_pkts; i++) {
>-			/* Offset of pointer to *bufs increases as packets are received
>-			 * from other slaves */
>-			num_rx_slave = rte_eth_rx_burst(internals->active_slaves[i],
>-					bd_rx_q->queue_id, bufs + num_rx_total, nb_pkts);
>-			if (num_rx_slave) {
>-				num_rx_total += num_rx_slave;
>-				nb_pkts -= num_rx_slave;
>-			}
>+	for (i = 0; i < internals->active_slave_count && nb_pkts; i++) {
>+		/* Offset of pointer to *bufs increases as packets are received
>+		 * from other slaves */
>+		num_rx_slave = rte_eth_rx_burst(internals->active_slaves[i],
>+				bd_rx_q->queue_id, bufs + num_rx_total, nb_pkts);
>+		if (num_rx_slave) {
>+			num_rx_total += num_rx_slave;
>+			nb_pkts -= num_rx_slave;
> 		}
>-		break;
>-	case BONDING_MODE_ACTIVE_BACKUP:
>-		num_rx_slave = rte_eth_rx_burst(internals->current_primary_port,
>-				bd_rx_q->queue_id, bufs, nb_pkts);
>-		if (num_rx_slave)
>-			num_rx_total = num_rx_slave;
>-		break;
> 	}
>+
> 	return num_rx_total;
> }
> 
> static uint16_t
>-bond_ethdev_tx_round_robin(void *queue, struct rte_mbuf **bufs,
>+bond_ethdev_rx_burst_active_backup(void *queue, struct rte_mbuf **bufs,
>+		uint16_t nb_pkts)
>+{
>+	struct bond_dev_private *internals;
>+
>+	/* Cast to structure, containing bonded device's port id and queue id */
>+	struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue;
>+
>+	internals = bd_rx_q->dev_private;
>+
>+	return rte_eth_rx_burst(internals->current_primary_port,
>+			bd_rx_q->queue_id, bufs, nb_pkts);
>+}
>+
>+static uint16_t
>+bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs,
> 		uint16_t nb_pkts)
> {
> 	struct bond_dev_private *dev_private;
>@@ -134,7 +138,7 @@ bond_ethdev_tx_round_robin(void *queue, struct
>rte_mbuf **bufs,
> }
> 
> static uint16_t
>-bond_ethdev_tx_active_backup(void *queue,
>+bond_ethdev_tx_burst_active_backup(void *queue,
> 		struct rte_mbuf **bufs, uint16_t nb_pkts)
> {
> 	struct bond_dev_private *internals;
>@@ -270,7 +274,8 @@ xmit_slave_hash(const struct rte_mbuf *buf, uint8_t
>slave_count, uint8_t policy)
> }
> 
> static uint16_t
>-bond_ethdev_tx_balance(void *queue, struct rte_mbuf **bufs, uint16_t
>nb_pkts)
>+bond_ethdev_tx_burst_balance(void *queue, struct rte_mbuf **bufs,
>+		uint16_t nb_pkts)
> {
> 	struct bond_dev_private *internals;
> 	struct bond_tx_queue *bd_tx_q;
>@@ -480,22 +485,25 @@ bond_ethdev_mode_set(struct rte_eth_dev *eth_dev,
>int mode)
> 
> 	switch (mode) {
> 	case BONDING_MODE_ROUND_ROBIN:
>-		eth_dev->tx_pkt_burst = bond_ethdev_tx_round_robin;
>+		eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_round_robin;
>+		eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
> 		break;
> 	case BONDING_MODE_ACTIVE_BACKUP:
>-		eth_dev->tx_pkt_burst = bond_ethdev_tx_active_backup;
>+		eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_active_backup;
>+		eth_dev->rx_pkt_burst = bond_ethdev_rx_burst_active_backup;
> 		break;
> 	case BONDING_MODE_BALANCE:
>-		eth_dev->tx_pkt_burst = bond_ethdev_tx_balance;
>+		eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_balance;
>+		eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
> 		break;
> 	case BONDING_MODE_BROADCAST:
> 		eth_dev->tx_pkt_burst = bond_ethdev_tx_burst_broadcast;
>+		eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
> 		break;
> 	default:
> 		return -1;
> 	}
> 
>-	eth_dev->rx_pkt_burst = bond_ethdev_rx_burst;
> 	internals->mode = mode;
> 
> 	return 0;
>-- 
>1.7.0.7
>

  reply	other threads:[~2014-08-20 20:21 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-19 13:51 [dpdk-dev] [PATCH 0/6] link bonding Declan Doherty
2014-08-19 13:51 ` [dpdk-dev] [PATCH 1/6] bond: link status interrupt support Declan Doherty
2014-08-20 20:24   ` Sanford, Robert
2014-08-19 13:51 ` [dpdk-dev] [PATCH 2/6] bond: removing switch statement from rx burst method Declan Doherty
2014-08-20 20:25   ` Sanford, Robert [this message]
2014-08-19 13:51 ` [dpdk-dev] [PATCH 3/6] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-08-20 20:25   ` Sanford, Robert
2014-08-19 13:51 ` [dpdk-dev] [PATCH 4/6] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-08-19 13:51 ` [dpdk-dev] [PATCH 5/6] test app: adding support for generating variable sized packets Declan Doherty
2014-08-19 13:51 ` [dpdk-dev] [PATCH 6/6] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-08-22  7:41 ` [dpdk-dev] [PATCH 0/6] link bonding Jiajia, SunX
2014-09-01  8:31 ` [dpdk-dev] [PATCH v2 " Declan Doherty
2014-09-02 13:31   ` De Lara Guarch, Pablo
2014-09-02 18:15   ` Stephen Hemminger
2014-09-01  8:31 ` [dpdk-dev] [PATCH v2 1/6] bond: link status interrupt support Declan Doherty
2014-09-01  8:31 ` [dpdk-dev] [PATCH v2 2/6] bond: removing switch statement from rx burst method Declan Doherty
2014-09-01  8:31 ` [dpdk-dev] [PATCH v2 3/6] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-09-01  8:31 ` [dpdk-dev] [PATCH v2 4/6] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-09-02  9:22   ` Doherty, Declan
2014-09-02  9:31     ` Thomas Monjalon
2014-09-23 13:18   ` [dpdk-dev] [PATCH v3 0/5] link bonding Declan Doherty
2014-09-23 13:18     ` [dpdk-dev] [PATCH v3 1/5] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-09-23 13:18     ` [dpdk-dev] [PATCH v3 2/5] test app: adding support for generating variable sized packet Declan Doherty
2014-09-23 13:18     ` [dpdk-dev] [PATCH v3 3/5] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-09-23 13:18     ` [dpdk-dev] [PATCH v3 4/5] bond: lsc polling support Declan Doherty
2014-09-24 13:16       ` Ananyev, Konstantin
2014-09-23 13:18     ` [dpdk-dev] [PATCH v3 5/5] bond: unit test test macro refactor Declan Doherty
2014-09-01  8:31 ` [dpdk-dev] [PATCH v2 5/6] test app: adding support for generating variable sized packets Declan Doherty
2014-09-01  8:31 ` [dpdk-dev] [PATCH v2 6/6] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-09-30  9:57 ` [dpdk-dev] [PATCH v4 0/8] link bonding Declan Doherty
2014-09-30  9:57   ` [dpdk-dev] [PATCH v4 1/8] bond: link status interrupt support Declan Doherty
2014-09-30  9:57   ` [dpdk-dev] [PATCH v4 2/8] bond: removing switch statement from rx burst method Declan Doherty
2014-09-30  9:57   ` [dpdk-dev] [PATCH v4 3/8] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-09-30  9:57   ` [dpdk-dev] [PATCH v4 4/8] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-10-13 15:29     ` De Lara Guarch, Pablo
2014-09-30  9:57   ` [dpdk-dev] [PATCH v4 5/8] test app: adding support for generating variable sized packet bursts Declan Doherty
2014-10-24  3:22     ` Liang, Cunming
2014-09-30  9:57   ` [dpdk-dev] [PATCH v4 6/8] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-09-30  9:57   ` [dpdk-dev] [PATCH v4 7/8] bond: lsc polling support Declan Doherty
2014-09-30  9:57   ` [dpdk-dev] [PATCH v4 8/8] bond: unit test test macro refactor Declan Doherty
2014-10-08  8:49   ` [dpdk-dev] [PATCH v4 0/8] link bonding Jiajia, SunX
2014-10-09 19:20   ` De Lara Guarch, Pablo
2014-10-14 12:59   ` [dpdk-dev] [PATCH v5 " Declan Doherty
2014-10-14 12:59     ` [dpdk-dev] [PATCH v5 1/8] bond: link status interrupt support Declan Doherty
2014-10-14 12:59     ` [dpdk-dev] [PATCH v5 2/8] bond: removing switch statement from rx burst method Declan Doherty
2014-10-14 12:59     ` [dpdk-dev] [PATCH v5 3/8] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-10-14 12:59     ` [dpdk-dev] [PATCH v5 4/8] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-10-14 12:59     ` [dpdk-dev] [PATCH v5 5/8] test app: adding support for generating variable sized packet Declan Doherty
2014-10-14 12:59     ` [dpdk-dev] [PATCH v5 6/8] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-10-14 12:59     ` [dpdk-dev] [PATCH v5 7/8] bond: lsc polling support Declan Doherty
2014-10-14 12:59     ` [dpdk-dev] [PATCH v5 8/8] bond: unit test test macro refactor Declan Doherty
2014-10-14 15:59     ` [dpdk-dev] [PATCH v5 0/8] link bonding De Lara Guarch, Pablo
2014-11-05  3:10     ` Jiajia, SunX
2014-11-07 12:22     ` [dpdk-dev] [PATCH v6 " Declan Doherty
2014-11-07 12:22       ` [dpdk-dev] [PATCH v6 1/8] bond: link status interrupt support Declan Doherty
2014-11-07 12:22       ` [dpdk-dev] [PATCH v6 2/8] bond: removing switch statement from rx burst method Declan Doherty
2014-11-07 12:22       ` [dpdk-dev] [PATCH v6 3/8] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-11-07 12:22       ` [dpdk-dev] [PATCH v6 4/8] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-11-07 12:22       ` [dpdk-dev] [PATCH v6 5/8] test app: adding support for generating variable sized packet Declan Doherty
2014-11-07 12:22       ` [dpdk-dev] [PATCH v6 6/8] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-11-07 12:22       ` [dpdk-dev] [PATCH v6 7/8] bond: lsc polling support Declan Doherty
2014-11-07 12:22       ` [dpdk-dev] [PATCH v6 8/8] bond: unit test test macro refactor Declan Doherty
2014-11-07 16:40       ` [dpdk-dev] [PATCH v6 0/8] link bonding De Lara Guarch, Pablo
2014-11-21 17:07         ` Doherty, Declan
2014-11-21 18:36           ` Thomas Monjalon
2014-11-23 13:40             ` Thomas Monjalon
2014-11-21  8:59       ` Jiajia, SunX
2014-11-24 12:27       ` [dpdk-dev] [PATCH v7 0/7] " Declan Doherty
2014-11-24 12:27         ` [dpdk-dev] [PATCH v7 1/7] bond: link status interrupt support Declan Doherty
2014-11-24 12:27         ` [dpdk-dev] [PATCH v7 2/7] bond: removing switch statement from rx burst method Declan Doherty
2014-11-24 12:27         ` [dpdk-dev] [PATCH v7 3/7] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-11-24 12:27         ` [dpdk-dev] [PATCH v7 4/7] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-11-24 12:27         ` [dpdk-dev] [PATCH v7 5/7] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-11-24 12:27         ` [dpdk-dev] [PATCH v7 6/7] bond: lsc polling support Declan Doherty
2014-11-24 12:27         ` [dpdk-dev] [PATCH v7 7/7] bond: unit test test macro refactor Declan Doherty
2014-11-24 15:35         ` [dpdk-dev] [PATCH v7 0/7] link bonding Thomas Monjalon
2014-11-24 16:24           ` Doherty, Declan
2014-11-24 17:53             ` Thomas Monjalon
2014-11-24 16:33         ` [dpdk-dev] [PATCH v8 " Declan Doherty
2014-11-24 16:33           ` [dpdk-dev] [PATCH v8 1/7] bond: link status interrupt support Declan Doherty
2014-11-24 16:33           ` [dpdk-dev] [PATCH v8 2/7] bond: removing switch statement from rx burst method Declan Doherty
2014-11-24 16:33           ` [dpdk-dev] [PATCH v8 3/7] bond: fix naming inconsistency in tx_burst_round_robin Declan Doherty
2014-11-24 16:33           ` [dpdk-dev] [PATCH v8 4/7] bond: free mbufs if transmission fails in bonding tx_burst functions Declan Doherty
2014-11-24 16:33           ` [dpdk-dev] [PATCH v8 5/7] testpmd: adding parameter to reconfig method to set socket_id when adding new port to portlist Declan Doherty
2014-11-24 16:33           ` [dpdk-dev] [PATCH v8 6/7] bond: lsc polling support Declan Doherty
2014-11-24 16:33           ` [dpdk-dev] [PATCH v8 7/7] bond: unit test test macro refactor Declan Doherty
2014-11-24 18:32           ` [dpdk-dev] [PATCH v8 0/7] link bonding Thomas Monjalon
2014-11-24 18:51             ` Thomas Monjalon
2014-11-24 20:54           ` Thomas Monjalon
2014-11-25 10:56             ` Jastrzebski, MichalX K
2014-11-25 11:20               ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D01A7C4F.27B7%rsanford@akamai.com \
    --to=rsanford@akamai.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).