From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by dpdk.org (Postfix) with ESMTP id 2ECF8333 for ; Tue, 1 Jul 2014 00:29:23 +0200 (CEST) Received: by mail-lb0-f177.google.com with SMTP id u10so6367770lbd.36 for ; Mon, 30 Jun 2014 15:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RlyJlMEv1CZZ1EX8a5dYCt3Qu630/Hmh+GGpcKPejUk=; b=ZTtzCqJLSxGcHpEJC6wITFylcTorBh0UzjdGqh3KtKiOSmWS9YSbu7bdJCbKh74Fc8 +1uKEcPKqytA8NXZq3t6+Voyh8V1zAHEaUGDDzXD4sC75G8/XaZN1zsdWTR94Kcz8kM4 syutwS9WQaZGXZq+5TlAMhXmOPFfDE4Gh3kIzi9WO8vqMMVkEhSFokWSBg2g+eL89Fwe o035V9SmsYiHDhPCtX63evld8a+8BPuwBCKaIYXrH/ePuyqSJnpQFFWa9vcU2tdBO20C zUVaOn7OQq3AMWBVFSzAZoot18qG7FLiTrj+6iQqA5hF3nfPcOSTAVNw0neYQybY7dc6 IwkQ== MIME-Version: 1.0 X-Received: by 10.152.19.164 with SMTP id g4mr8775333lae.47.1404167382327; Mon, 30 Jun 2014 15:29:42 -0700 (PDT) Received: by 10.152.1.201 with HTTP; Mon, 30 Jun 2014 15:29:42 -0700 (PDT) In-Reply-To: <1404064161-26370-2-git-send-email-declan.doherty@intel.com> References: <1403864324-12022-1-git-send-email-declan.doherty@intel.com> <1404064161-26370-2-git-send-email-declan.doherty@intel.com> Date: Mon, 30 Jun 2014 18:29:42 -0400 Message-ID: From: Robert Sanford To: Declan Doherty Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v11 1/5] bond: new link bonding library X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2014 22:29:23 -0000 Hi Declan, On Sun, Jun 29, 2014 at 1:49 PM, Declan Doherty 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 > --- > 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