This patch adds the following support to the HNS3 driver:
1. Support to change the Maximum Transmission Unit of a
of a port in the HNS NIC hardware.
2. Initializes the supported MTU range for the netdevice.
Signed-off-by: lipeng <redacted>
Signed-off-by: Salil Mehta <redacted>
---
PATCH V3: Addressed some minor comments Leon Romanovsky
1. https://lkml.org/lkml/2017/8/20/27
PATCH V2: Addresses comments given by Andrew Lunn
1. https://lkml.org/lkml/2017/8/18/282
PATCH V1: Initial Submit
---
.../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 36 ++++++++++++++++++++++
.../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h | 1 +
2 files changed, 37 insertions(+)
@@ -1278,11 +1278,44 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,returnret;}+staticinthns3_nic_change_mtu(structnet_device*netdev,intnew_mtu)+{+structhns3_nic_priv*priv=netdev_priv(netdev);+structhnae3_handle*h=priv->ae_handle;+boolif_running=netif_running(netdev);+intret;++if(!h->ae_algo->ops->set_mtu)+return-ENOTSUPP;++/* if this was called with netdev up then bring netdevice down */+if(if_running){+(void)hns3_nic_net_stop(netdev);+msleep(100);+}++ret=h->ae_algo->ops->set_mtu(h,new_mtu);+if(ret){+netdev_err(netdev,"failed to change MTU in hardware %d\n",+ret);+returnret;+}++/* if the netdev was running earlier, bring it up again */+if(if_running){+if(hns3_nic_net_open(netdev))+ret=-EINVAL;+}++returnret;+}+staticconststructnet_device_opshns3_nic_netdev_ops={.ndo_open=hns3_nic_net_open,.ndo_stop=hns3_nic_net_stop,.ndo_start_xmit=hns3_nic_net_xmit,.ndo_set_mac_address=hns3_nic_net_set_mac_address,+.ndo_change_mtu=hns3_nic_change_mtu,.ndo_set_features=hns3_nic_set_features,.ndo_get_stats64=hns3_nic_get_stats64,.ndo_setup_tc=hns3_nic_setup_tc,
@@ -2752,6 +2785,9 @@ static int hns3_client_init(struct hnae3_handle *handle)gotoout_reg_netdev_fail;}+/* MTU range: (ETH_MIN_MTU(kernel default) - 9706) */+netdev->max_mtu=HNS3_MAX_MTU-(ETH_HLEN+ETH_FCS_LEN+VLAN_HLEN);+returnret;out_reg_netdev_fail:
From: Leon Romanovsky <leon@kernel.org> Date: 2017-08-21 10:32:25
On Mon, Aug 21, 2017 at 11:12:23AM +0100, Salil Mehta wrote:
quoted hunk
This patch adds the following support to the HNS3 driver:
1. Support to change the Maximum Transmission Unit of a
of a port in the HNS NIC hardware.
2. Initializes the supported MTU range for the netdevice.
Signed-off-by: lipeng <redacted>
Signed-off-by: Salil Mehta <redacted>
---
PATCH V3: Addressed some minor comments Leon Romanovsky
1. https://lkml.org/lkml/2017/8/20/27
PATCH V2: Addresses comments given by Andrew Lunn
1. https://lkml.org/lkml/2017/8/18/282
PATCH V1: Initial Submit
---
.../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 36 ++++++++++++++++++++++
.../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h | 1 +
2 files changed, 37 insertions(+)
@@ -1278,11 +1278,44 @@ static int hns3_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan,returnret;}+staticinthns3_nic_change_mtu(structnet_device*netdev,intnew_mtu)+{+structhns3_nic_priv*priv=netdev_priv(netdev);+structhnae3_handle*h=priv->ae_handle;+boolif_running=netif_running(netdev);+intret;++if(!h->ae_algo->ops->set_mtu)+return-ENOTSUPP;
Sorry for not spotting this before, but it should be -EOPNOTSUPP and not -ENOTSUPP.
quoted hunk
++ /* if this was called with netdev up then bring netdevice down */+ if (if_running) {+ (void)hns3_nic_net_stop(netdev);+ msleep(100);+ }++ ret = h->ae_algo->ops->set_mtu(h, new_mtu);+ if (ret) {+ netdev_err(netdev, "failed to change MTU in hardware %d\n",+ ret);+ return ret;+ }++ /* if the netdev was running earlier, bring it up again */+ if (if_running) {+ if (hns3_nic_net_open(netdev))+ ret = -EINVAL;+ }
Anyway, you will resubmit because of wrong error code.
if (if_running && hns3_nic_net_open(netdev))
ret = -EINVAL
Thanks
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Leon Romanovsky [mailto:leon@kernel.org]
Sent: Monday, August 21, 2017 11:32 AM
To: Salil Mehta
Cc: davem@davemloft.net; Zhuangyuzeng (Yisen); lipeng (Y);
mehta.salil.lnk@gmail.com; netdev@vger.kernel.org; linux-
kernel@vger.kernel.org; linux-rdma@vger.kernel.org; Linuxarm
Subject: Re: [PATCH V3 net-next] net: hns3: Add support to change MTU
in HNS3 hardware
On Mon, Aug 21, 2017 at 11:12:23AM +0100, Salil Mehta wrote:
quoted
This patch adds the following support to the HNS3 driver:
1. Support to change the Maximum Transmission Unit of a
of a port in the HNS NIC hardware.
Typo-->Will also delete duplicate 'of a'
quoted
2. Initializes the supported MTU range for the netdevice.
Signed-off-by: lipeng <redacted>
Signed-off-by: Salil Mehta <redacted>
---
PATCH V3: Addressed some minor comments Leon Romanovsky
1. https://lkml.org/lkml/2017/8/20/27
PATCH V2: Addresses comments given by Andrew Lunn
1. https://lkml.org/lkml/2017/8/18/282
PATCH V1: Initial Submit
---
.../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 36
Sorry for not spotting this before, but it should be -EOPNOTSUPP and
not -ENOTSUPP.
Yes, Maybe I should have seen it earlier as well :(
I Will rectify this.
Thanks
quoted
++ /* if this was called with netdev up then bring netdevice down */+ if (if_running) {+ (void)hns3_nic_net_stop(netdev);+ msleep(100);+ }++ ret = h->ae_algo->ops->set_mtu(h, new_mtu);+ if (ret) {+ netdev_err(netdev, "failed to change MTU in hardware %d\n",+ ret);+ return ret;+ }++ /* if the netdev was running earlier, bring it up again */+ if (if_running) {+ if (hns3_nic_net_open(netdev))+ ret = -EINVAL;+ }
Anyway, you will resubmit because of wrong error code.
if (if_running && hns3_nic_net_open(netdev))
ret = -EINVAL
Thanks
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-08-21 14:29:44
On Mon, Aug 21, 2017 at 11:12:23AM +0100, Salil Mehta wrote:
This patch adds the following support to the HNS3 driver:
1. Support to change the Maximum Transmission Unit of a
of a port in the HNS NIC hardware.
2. Initializes the supported MTU range for the netdevice.
Signed-off-by: lipeng <redacted>
Signed-off-by: Salil Mehta <redacted>
Hi Salil
Apart from Leon comments.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
-----Original Message-----
From: Andrew Lunn [mailto:andrew-g2DYL2Zd6BY@public.gmane.org]
Sent: Monday, August 21, 2017 3:30 PM
To: Salil Mehta
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org; Zhuangyuzeng (Yisen); lipeng (Y);
mehta.salil.lnk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-
kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Linuxarm
Subject: Re: [PATCH V3 net-next] net: hns3: Add support to change MTU
in HNS3 hardware
On Mon, Aug 21, 2017 at 11:12:23AM +0100, Salil Mehta wrote:
quoted
This patch adds the following support to the HNS3 driver:
1. Support to change the Maximum Transmission Unit of a
of a port in the HNS NIC hardware.
2. Initializes the supported MTU range for the netdevice.
Signed-off-by: lipeng <redacted>
Signed-off-by: Salil Mehta <redacted>
Hi Salil
Apart from Leon comments.
Reviewed-by: Andrew Lunn <redacted>
Andrew
I will incorporate Leon's comment and float V4 patch today. Thanks!
Best regards
Salil
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Leon Romanovsky <leon@kernel.org> Date: 2017-08-21 14:47:47
On Mon, Aug 21, 2017 at 02:32:40PM +0000, Salil Mehta wrote:
Hi Andrew,
quoted
-----Original Message-----
From: Andrew Lunn [mailto:andrew-g2DYL2Zd6BY@public.gmane.org]
Sent: Monday, August 21, 2017 3:30 PM
To: Salil Mehta
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org; Zhuangyuzeng (Yisen); lipeng (Y);
mehta.salil.lnk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-
kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Linuxarm
Subject: Re: [PATCH V3 net-next] net: hns3: Add support to change MTU
in HNS3 hardware
On Mon, Aug 21, 2017 at 11:12:23AM +0100, Salil Mehta wrote:
quoted
This patch adds the following support to the HNS3 driver:
1. Support to change the Maximum Transmission Unit of a
of a port in the HNS NIC hardware.
2. Initializes the supported MTU range for the netdevice.
Signed-off-by: lipeng <redacted>
Signed-off-by: Salil Mehta <redacted>
Hi Salil
Apart from Leon comments.
Reviewed-by: Andrew Lunn <redacted>
Andrew
I will incorporate Leon's comment and float V4 patch today. Thanks!
Salil,
I had two comment there and not one. Please don't miss it :)
Thanks
Best regards
Salil
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
-----Original Message-----
From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-
owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Leon Romanovsky
Sent: Monday, August 21, 2017 3:48 PM
To: Salil Mehta
Cc: Andrew Lunn; davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org; Zhuangyuzeng (Yisen); lipeng (Y);
mehta.salil.lnk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-
kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Linuxarm
Subject: Re: [PATCH V3 net-next] net: hns3: Add support to change MTU
in HNS3 hardware
On Mon, Aug 21, 2017 at 02:32:40PM +0000, Salil Mehta wrote:
quoted
Hi Andrew,
quoted
-----Original Message-----
From: Andrew Lunn [mailto:andrew-g2DYL2Zd6BY@public.gmane.org]
Sent: Monday, August 21, 2017 3:30 PM
To: Salil Mehta
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org; Zhuangyuzeng (Yisen); lipeng (Y);
mehta.salil.lnk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-
kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Linuxarm
Subject: Re: [PATCH V3 net-next] net: hns3: Add support to change
MTU
quoted
quoted
in HNS3 hardware
On Mon, Aug 21, 2017 at 11:12:23AM +0100, Salil Mehta wrote:
quoted
This patch adds the following support to the HNS3 driver:
1. Support to change the Maximum Transmission Unit of a
of a port in the HNS NIC hardware.
2. Initializes the supported MTU range for the netdevice.
Signed-off-by: lipeng <redacted>
Signed-off-by: Salil Mehta <redacted>
Hi Salil
Apart from Leon comments.
Reviewed-by: Andrew Lunn <redacted>
Andrew
I will incorporate Leon's comment and float V4 patch today. Thanks!
Salil,
I had two comment there and not one. Please don't miss it :)
Sure, I should admit that I missed one comment while I replied to the
mail but later realized that, and incorporated it while I floated the
V4 patch. Having a bad day of misses...phew!
Again, thanks Andrew & Leon for helping me out in reviewing this patch.
Best regards
Salil
Thanks
quoted
Best regards
Salil
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma"
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html