From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 10A572904 for ; Tue, 9 Jan 2018 16:32:35 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2018 07:32:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,336,1511856000"; d="scan'208";a="18701207" Received: from dwdohert-mobl.ger.corp.intel.com (HELO [163.33.228.213]) ([163.33.228.213]) by orsmga003.jf.intel.com with ESMTP; 09 Jan 2018 07:32:34 -0800 To: Sharmila Podury Cc: dev@dpdk.org, Sharmila Podury References: <20180104063443.1821-1-sharmila.podury@gmail.com> From: "Doherty, Declan" Message-ID: <680ceda0-3474-bcfe-bd28-de99d8ac5243@intel.com> Date: Tue, 9 Jan 2018 15:32:33 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180104063443.1821-1-sharmila.podury@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] net/bonding: add ethdev ops function for MTU set 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: , X-List-Received-Date: Tue, 09 Jan 2018 15:32:36 -0000 On 04/01/2018 6:34 AM, Sharmila Podury wrote: > From: Sharmila Podury > > Set the MTU for bonding device by calling .mtu_set for all > the slaves. Set the MTU only if all slaves support .mtu_set, > and there is no error returned from any slave. > > Signed-off-by: Sharmila Podury > --- > drivers/net/bonding/rte_eth_bond_pmd.c | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c > index fe2328954..183bdbafc 100644 > --- a/drivers/net/bonding/rte_eth_bond_pmd.c > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c > @@ -2707,6 +2707,34 @@ bond_ethdev_rss_hash_conf_get(struct rte_eth_dev *dev, > return 0; > } > > +static int > +bond_ethdev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) > +{ > + struct rte_eth_dev *slave_eth_dev; > + struct bond_dev_private *internals = dev->data->dev_private; > + int ret, i; > + > + rte_spinlock_lock(&internals->lock); > + > + for (i = 0; i < internals->slave_count; i++) { > + slave_eth_dev = &rte_eth_devices[internals->slaves[i].port_id]; > + if (*slave_eth_dev->dev_ops->mtu_set == NULL) { > + rte_spinlock_unlock(&internals->lock); > + return -ENOTSUP; > + } > + } > + for (i = 0; i < internals->slave_count; i++) { > + ret = rte_eth_dev_set_mtu(internals->slaves[i].port_id, mtu); > + if (ret < 0) { > + rte_spinlock_unlock(&internals->lock); > + return ret; > + } > + } > + > + rte_spinlock_unlock(&internals->lock); > + return 0; > +} > + > const struct eth_dev_ops default_dev_ops = { > .dev_start = bond_ethdev_start, > .dev_stop = bond_ethdev_stop, > @@ -2726,7 +2754,8 @@ const struct eth_dev_ops default_dev_ops = { > .reta_update = bond_ethdev_rss_reta_update, > .reta_query = bond_ethdev_rss_reta_query, > .rss_hash_update = bond_ethdev_rss_hash_update, > - .rss_hash_conf_get = bond_ethdev_rss_hash_conf_get > + .rss_hash_conf_get = bond_ethdev_rss_hash_conf_get, > + .mtu_set = bond_ethdev_mtu_set > }; > > static int > Acked-by: Declan Doherty