From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 58954A00E6 for ; Wed, 20 Mar 2019 14:39:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 894435F28; Wed, 20 Mar 2019 14:39:39 +0100 (CET) Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) by dpdk.org (Postfix) with ESMTP id 35D335F20 for ; Wed, 20 Mar 2019 14:39:38 +0100 (CET) Received: by mail-vs1-f47.google.com with SMTP id e126so1495267vse.1 for ; Wed, 20 Mar 2019 06:39:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/l+WWJsThv4Gd1iYMTZrlgU9ovs6cf5/ZH3Jkf/YhpY=; b=mST2ZYe5AttMW0MiUGbJ4IbSOplIZLbvnucsdSYwuZQIxiogYeavHH2jM1i+iXbwlT 215DOQuylaiBEDvOHNqPAgwlWqL6WfRjKqwgIZQcpOHU+EPRLlNbtDjDAdemuEtxVwNa vPAUakmCM7JRggLE31uRTtQtw0nw02y/t56iv2yYekKDd2d/kJtE7QSaIhF7n//FZS7Q qL6mkiBmsOFdzBiBVOnDC+WxDZv+Rk4NlUIVcD28NBzzVV3DUdTqvmNMLBPIAnXk0Nkg doenkBHDyHruxtN8jXAQoSJ6sbL+Aje0Bf6tbSSLQp6crM6hy88yYXip36B9wn/xgETk voqQ== X-Gm-Message-State: APjAAAWmwQ5HSO9pIUjMD+NmBmtJPpcB8I2EID2DFC8lap1X7uijOeVR 65FHo6xdRHrW9CJyoleS87CmG7hXyn63mjN4lJHNPQ== X-Google-Smtp-Source: APXvYqxD7icUnp3St6LDiSyO399/grKAFa0Yi1qyNGjv8ZuNdIBUgkecTZtLXScJqOM7Cc65q5dNRn8nmvlID/XNB7A= X-Received: by 2002:a67:2444:: with SMTP id k65mr4804157vsk.39.1553089177454; Wed, 20 Mar 2019 06:39:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: David Marchand Date: Wed, 20 Mar 2019 14:39:26 +0100 Message-ID: To: "Zhaohui (zhaohui, Polestar)" Cc: "dev@dpdk.org" , Chas Williams <3chas3@gmail.com>, Ferruh Yigit , chenchanghu , "stable@dpdk.org" , wangyunjian Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] =?utf-8?q?=5BPATCH=5D_net/bonding=3A_fix_Segfault_when?= =?utf-8?q?_eal_thread_executing_nic=E2=80=98s_lsc_event_for_mode_4?= X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190320133926.6LGaawG6BeyBWhXzOetg_LyoMbDbd9_9FpE1RXohxtI@z> On Wed, Mar 20, 2019 at 2:26 PM Zhaohui (zhaohui, Polestar) < zhaohui8@huawei.com> wrote: > Hi=EF=BC=9A > When the number of slave slave devices exceeds 8, it will cause > the array subscript to cross the boundary. > According to the suggestions, Modified array subscript to > RTE_MAX_ETHPORTS, and Changed uint8_t to uint16_t. Something like this: > > From 51a081ea88cca1599d458d8d1c7d9605a6eb3352 Mon Sep 17 00:00:00 2001 > From: zhaohui8 > Date: Wed, 20 Mar 2019 20:17:27 +0800 > Subject: [PATCH] net/bonding: fix Segfault when eal thread executing nic= =E2=80=98s > lsc event for mode 4 > > Change-Id: I6d800a3adf5ca51f295b607de879bcb0ccc20004 > --- > drivers/net/bonding/rte_eth_bond_8023ad.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c > b/drivers/net/bonding/rte_eth_bond_8023ad.c > index dd847c6..4d99239 100644 > --- a/drivers/net/bonding/rte_eth_bond_8023ad.c > +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c > @@ -638,7 +638,7 @@ > SM_FLAG_CLR(port, NTT); > } > -static uint8_t > +static uint16_t > max_index(uint64_t *a, int n) > { > if (n <=3D 0) > @@ -664,15 +664,15 @@ > * @param port_pos Port to assign. > */ > static void > -selection_logic(struct bond_dev_private *internals, uint8_t slave_id) > +selection_logic(struct bond_dev_private *internals, uint16_t slave_id) > { > struct port *agg, *port; > uint16_t slaves_count, new_agg_id, i, j =3D 0; > uint16_t *slaves; > - uint64_t agg_bandwidth[8] =3D {0}; > - uint64_t agg_count[8] =3D {0}; > + uint64_t agg_bandwidth[RTE_MAX_ETHPORTS] =3D {0}; > + uint64_t agg_count[RTE_MAX_ETHPORTS] =3D {0}; > uint16_t default_slave =3D 0; > - uint8_t mode_count_id, mode_band_id; > + uint16_t mode_count_id, mode_band_id; > struct rte_eth_link link_info; > slaves =3D internals->active_slaves; > @@ -806,7 +806,7 @@ > struct ether_addr slave_addr; > struct rte_mbuf *lacp_pkt =3D NULL; > - uint8_t i, slave_id; > + uint16_t i, slave_id; > > /* Update link status on each port */ > -- > 1.9.5.msysgit.0 > > Oh, I had missed this [8] array, good catch. For the slave id on 16bits, I sent this earlier: http://patchwork.dpdk.org/patch/51387/ And I have other fixes for 802.3ad that I will send once properly tested. --=20 David Marchand