[dpdk-dev] [PATCH v11 1/5] bond: new link bonding library
Robert Sanford
rsanford2 at gmail.com
Tue Jul 1 00:29:42 CEST 2014
Hi Declan,
On Sun, Jun 29, 2014 at 1:49 PM, Declan Doherty <declan.doherty at intel.com>
wrote:
> Initial release with support for
> Mode 0 - Round Robin
> Mode 1 - Active Backup
> Mode 2 - Balance -> Supports 3 transmit polices (layer 2, layer 2+3,
> layer 3+4)
> Mode 3 - Broadcast
>
> Signed-off-by: Declan Doherty <declan.doherty at intel.com>
> ---
> config/common_bsdapp | 5 +
> config/common_linuxapp | 5 +
> doc/doxy-api-index.md | 1 +
> doc/doxy-api.conf | 1 +
> lib/Makefile | 1 +
> lib/librte_pmd_bond/Makefile | 61 ++
> lib/librte_pmd_bond/rte_eth_bond.h | 255 ++++++
> lib/librte_pmd_bond/rte_eth_bond_api.c | 662 +++++++++++++++
> lib/librte_pmd_bond/rte_eth_bond_args.c | 252 ++++++
> lib/librte_pmd_bond/rte_eth_bond_pmd.c | 1212
> ++++++++++++++++++++++++++++
> lib/librte_pmd_bond/rte_eth_bond_private.h | 215 +++++
> mk/rte.app.mk | 4 +
> 12 files changed, 2674 insertions(+), 0 deletions(-)
> create mode 100644 lib/librte_pmd_bond/Makefile
> create mode 100644 lib/librte_pmd_bond/rte_eth_bond.h
> create mode 100644 lib/librte_pmd_bond/rte_eth_bond_api.c
> create mode 100644 lib/librte_pmd_bond/rte_eth_bond_args.c
> create mode 100644 lib/librte_pmd_bond/rte_eth_bond_pmd.c
> create mode 100644 lib/librte_pmd_bond/rte_eth_bond_private.h
>
>
>
I see a potential problem with bond_ethdev_rx_burst( ).
We could receive more packets than the caller asked for, and overrun the
caller's rte_mbuf * array.
The fix could be something like this:
--- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c
+++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c
@@ -73,13 +73,15 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf
**bufs, uint16_t nb_pkts)
case BONDING_MODE_ROUND_ROBIN:
case BONDING_MODE_BROADCAST:
case BONDING_MODE_BALANCE:
- for (i = 0; i < internals->active_slave_count; i++) {
+ 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)
+ if (num_rx_slave) {
num_rx_total += num_rx_slave;
+ nb_pkts -= num_rx_slave;
+ }
}
break;
case BONDING_MODE_ACTIVE_BACKUP:
--
Regards,
Robert
More information about the dev
mailing list