From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id AA509231C for ; Thu, 27 Nov 2014 22:28:40 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 27 Nov 2014 13:28:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,471,1413270000"; d="scan'208";a="639253210" Received: from irsmsx155.ger.corp.intel.com ([163.33.192.3]) by fmsmga002.fm.intel.com with ESMTP; 27 Nov 2014 13:28:38 -0800 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.105]) by IRSMSX155.ger.corp.intel.com ([169.254.14.228]) with mapi id 14.03.0195.001; Thu, 27 Nov 2014 21:28:37 +0000 From: "Doherty, Declan" To: "dev@dpdk.org" Thread-Topic: [PATCH v2] bond: set {rx|tx}_offload_capa flags Thread-Index: AQHQCoh5k1TZuf8aWE2XTZG2EZC+WZx0/NSA Date: Thu, 27 Nov 2014 21:28:37 +0000 Message-ID: <345C63BAECC1AD42A2EC8C63AFFC3ADC27427632@IRSMSX101.ger.corp.intel.com> References: <1415381738-43417-1-git-send-email-jyu@vmware.com> <1417123417-26444-1-git-send-email-declan.doherty@intel.com> In-Reply-To: <1417123417-26444-1-git-send-email-declan.doherty@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] bond: set {rx|tx}_offload_capa flags 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: Thu, 27 Nov 2014 21:28:41 -0000 Self nack, need to rebase again as mode 4 and 5 patches have been applied. > -----Original Message----- > From: Doherty, Declan > Sent: Thursday, November 27, 2014 9:24 PM > To: dev@dpdk.org > Cc: jyu@vmware.com; thomas.monjalon@6wind.com; Doherty, Declan > Subject: [PATCH v2] bond: set {rx|tx}_offload_capa flags >=20 > v2: > rebased to HEAD >=20 > From: Jia Yu >=20 > Before the fix, bond device's offload capabilities are unset. This fix > takes the minimum common set of slave devices' capabilities as bond > device's capabilities. For simplicity, we ensure all slave devices > to have a capability before bond device can claim this capability, > even if some slave devices are unused (i.e. linked down, standby). >=20 > Signed-off-by: Jia Yu > Signed-off-by: Declan Doherty > --- > lib/librte_pmd_bond/rte_eth_bond_api.c | 18 +++++++++++++++++- > lib/librte_pmd_bond/rte_eth_bond_pmd.c | 5 +++++ > lib/librte_pmd_bond/rte_eth_bond_private.h | 3 +++ > 3 files changed, 25 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_pmd_bond/rte_eth_bond_api.c > b/lib/librte_pmd_bond/rte_eth_bond_api.c > index f146bda..5125b57 100644 > --- a/lib/librte_pmd_bond/rte_eth_bond_api.c > +++ b/lib/librte_pmd_bond/rte_eth_bond_api.c > @@ -238,6 +238,8 @@ rte_eth_bond_create(const char *name, uint8_t mode, > uint8_t socket_id) >=20 > internals->slave_count =3D 0; > internals->active_slave_count =3D 0; > + internals->rx_offload_capa =3D 0; > + internals->tx_offload_capa =3D 0; >=20 > memset(internals->active_slaves, 0, sizeof(internals->active_slaves)); > memset(internals->slaves, 0, sizeof(internals->slaves)); > @@ -265,6 +267,7 @@ __eth_bond_slave_add_lock_free(uint8_t > bonded_port_id, uint8_t slave_port_id) > struct bond_dev_private *internals; > struct bond_dev_private *temp_internals; > struct rte_eth_link link_props; > + struct rte_eth_dev_info dev_info; >=20 > int i, j; >=20 > @@ -296,6 +299,9 @@ __eth_bond_slave_add_lock_free(uint8_t > bonded_port_id, uint8_t slave_port_id) > /* Add slave details to bonded device */ > slave_add(internals, slave_eth_dev); >=20 > + memset(&dev_info, 0, sizeof(dev_info)); > + rte_eth_dev_info_get(slave_port_id, &dev_info); > + > if (internals->slave_count < 1) { > /* if MAC is not user defined then use MAC of first slave add to > * bonded device */ > @@ -308,6 +314,11 @@ __eth_bond_slave_add_lock_free(uint8_t > bonded_port_id, uint8_t slave_port_id) >=20 > /* Make primary slave */ > internals->primary_port =3D slave_port_id; > + > + /* Take the first dev's offload capabilities */ > + internals->rx_offload_capa =3D dev_info.rx_offload_capa; > + internals->tx_offload_capa =3D dev_info.tx_offload_capa; > + > } else { > /* Check slave link properties are supported if props are set, > * all slaves must be the same */ > @@ -323,6 +334,8 @@ __eth_bond_slave_add_lock_free(uint8_t > bonded_port_id, uint8_t slave_port_id) > link_properties_set(bonded_eth_dev, > &(slave_eth_dev->data->dev_link)); > } > + internals->rx_offload_capa &=3D dev_info.rx_offload_capa; > + internals->tx_offload_capa &=3D dev_info.tx_offload_capa; > } >=20 > internals->slave_count++; > @@ -455,7 +468,10 @@ __eth_bond_slave_remove_lock_free(uint8_t > bonded_port_id, uint8_t slave_port_id) > memset(rte_eth_devices[bonded_port_id].data- > >mac_addrs, 0, >=20 > sizeof(*(rte_eth_devices[bonded_port_id].data->mac_addrs))); > } > - > + if (internals->slave_count =3D=3D 0) { > + internals->rx_offload_capa =3D 0; > + internals->tx_offload_capa =3D 0; > + } > return 0; > } >=20 > diff --git a/lib/librte_pmd_bond/rte_eth_bond_pmd.c > b/lib/librte_pmd_bond/rte_eth_bond_pmd.c > index cf2fbab..0d1a36b 100644 > --- a/lib/librte_pmd_bond/rte_eth_bond_pmd.c > +++ b/lib/librte_pmd_bond/rte_eth_bond_pmd.c > @@ -788,6 +788,8 @@ static int bond_ethdev_configure(struct rte_eth_dev > *dev); > static void > bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_i= nfo) > { > + struct bond_dev_private *internals =3D dev->data->dev_private; > + > dev_info->driver_name =3D driver_name; > dev_info->max_mac_addrs =3D 1; >=20 > @@ -798,6 +800,9 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct > rte_eth_dev_info *dev_info) >=20 > dev_info->min_rx_bufsize =3D 0; > dev_info->pci_dev =3D dev->pci_dev; > + > + dev_info->rx_offload_capa =3D internals->rx_offload_capa; > + dev_info->tx_offload_capa =3D internals->tx_offload_capa; > } >=20 > static int > diff --git a/lib/librte_pmd_bond/rte_eth_bond_private.h > b/lib/librte_pmd_bond/rte_eth_bond_private.h > index 6254c84..2096f81 100644 > --- a/lib/librte_pmd_bond/rte_eth_bond_private.h > +++ b/lib/librte_pmd_bond/rte_eth_bond_private.h > @@ -144,6 +144,9 @@ struct bond_dev_private { > struct bond_slave_details slaves[RTE_MAX_ETHPORTS]; > /**< Arary of bonded slaves details */ >=20 > + uint32_t rx_offload_capa; /** Rx offload capability */ > + uint32_t tx_offload_capa; /** Tx offload capability */ > + > struct rte_kvargs *kvlist; > }; >=20 > -- > 1.7.12.2