From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: Re: [PATCH v1] net/mlx: control netdevices through ioctl only Date: Mon, 12 Feb 2018 09:47:15 +0100 Message-ID: <20180212084715.GF4256@6wind.com> References: <20180208163538.22407-1-adrien.mazarguil@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: =?utf-8?B?TsOpbGlv?= Laranjeiro , Yongseok Koh , "dev@dpdk.org" To: Shahaf Shuler Return-path: Received: from mail-wr0-f172.google.com (mail-wr0-f172.google.com [209.85.128.172]) by dpdk.org (Postfix) with ESMTP id EDD291B2D8 for ; Mon, 12 Feb 2018 09:47:28 +0100 (CET) Received: by mail-wr0-f172.google.com with SMTP id h9so14307864wre.12 for ; Mon, 12 Feb 2018 00:47:28 -0800 (PST) Content-Disposition: inline In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Shahaf, On Sun, Feb 11, 2018 at 11:55:44AM +0000, Shahaf Shuler wrote: > Hi Adrien, > > Small doc issues. > > -/** > > * Perform ifreq ioctl() on associated Ethernet device. > > * > > * @param[in] priv > > @@ -361,12 +200,12 @@ mlx4_get_mac(struct priv *priv, uint8_t > > (*mac)[ETHER_ADDR_LEN]) int mlx4_mtu_get(struct priv *priv, uint16_t > > *mtu) { > > - unsigned long ulong_mtu = 0; > > - int ret = mlx4_get_sysfs_ulong(priv, "mtu", &ulong_mtu); > > + struct ifreq request; > > + int ret = mlx4_ifreq(priv, SIOCGIFMTU, &request); > > > > if (ret) > > return ret; > > Function documentation is : "0 on success, negative errno value otherwise and rte_errno is set." > Per my understating ioctl returns -1 on error with errno set. Since the positive/negative errno mess was addressed in mlx4 (commit 9d14b27308a0 "net/mlx4: standardize on negative errno value"), unlike mlx5's priv_ifreq(), mlx4_ifreq() returns a negative errno value with rte_errno set in case of error. Simply returning ret is enough as rte_errno is left unmodified; all functions are already documented accordingly. > > @@ -385,20 +224,13 @@ int > > mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) { > > struct priv *priv = dev->data->dev_private; > > - uint16_t new_mtu; > > - int ret = mlx4_set_sysfs_ulong(priv, "mtu", mtu); > > + struct ifreq request = { .ifr_mtu = mtu, }; > > + int ret = mlx4_ifreq(priv, SIOCSIFMTU, &request); > > > > if (ret) > > return ret; > > Also here. Ditto. > > @@ -417,14 +249,14 @@ mlx4_mtu_set(struct rte_eth_dev *dev, uint16_t > > mtu) static int mlx4_set_flags(struct priv *priv, unsigned int keep, unsigned > > int flags) { > > - unsigned long tmp = 0; > > - int ret = mlx4_get_sysfs_ulong(priv, "flags", &tmp); > > + struct ifreq request; > > + int ret = mlx4_ifreq(priv, SIOCGIFFLAGS, &request); > > > > if (ret) > > return ret; > > And here. Ditto. No need for a v2. -- Adrien Mazarguil 6WIND