From: Peiyang Wang wangpeiyang1@huawei.com
driver inclusion category:feature bugzilla: https://gitee.com/openeuler/kernel/issues/I9A3QT CVE: NA
----------------------------------------------------------------------
To use arp proxy more conviency, add an arp proxy switch in ethool. Use followed command to open or close arp proxy: ethtool --set-priv-flags <device_name> roh_arp_proxy_enable <on/off>
Use followed command to find current state of arp proxy switch: ethtool --show-priv-flags <device_name>
The results are showed as followed: ... roh_arp_proxy_enable: on
Signed-off-by: Peiyang Wang wangpeiyang1@huawei.com Signed-off-by: Jiantao Xiao xiaojiantao1@h-partners.com --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 + drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 ++++++ drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 8 ++++++++ 3 files changed, 15 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index d484d92ded6f..484cd7744a49 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -917,6 +917,7 @@ struct hnae3_roce_private_info { enum hnae3_pflag { HNAE3_PFLAG_LIMIT_PROMISC, HNAE3_PFLAG_FD_QB_ENABLE, + HNAE3_PFLAG_ROH_ARP_PROXY_ENABLE, HNAE3_PFLAG_MAX };
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 52b1ae1e57e5..a8f320eb3637 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -5354,6 +5354,12 @@ static void hns3_state_init(struct hnae3_handle *handle)
if (hnae3_ae_dev_rxd_adv_layout_supported(ae_dev)) set_bit(HNS3_NIC_STATE_RXD_ADV_LAYOUT_ENABLE, &priv->state); + + if (hnae3_check_roh_mac_type(handle)) { + set_bit(HNAE3_PFLAG_ROH_ARP_PROXY_ENABLE, + &handle->supported_pflags); + set_bit(HNAE3_PFLAG_ROH_ARP_PROXY_ENABLE, &handle->priv_flags); + } }
static void hns3_state_uninit(struct hnae3_handle *handle) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index c0a21af54bc9..c065c759e8cd 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -477,9 +477,17 @@ static void hns3_update_fd_qb_state(struct net_device *netdev, bool enable) handle->ae_algo->ops->request_flush_qb_config(handle); }
+static void hns3_update_roh_arp_proxy_enable(struct net_device *netdev, + bool enable) +{ + netdev_info(netdev, "%s roh arp proxy\n", + enable ? "enable" : "disable"); +} + static const struct hns3_pflag_desc hns3_priv_flags[HNAE3_PFLAG_MAX] = { { "limit_promisc", hns3_update_limit_promisc_mode }, { "qb_enable", hns3_update_fd_qb_state }, + { "roh_arp_proxy_enable", hns3_update_roh_arp_proxy_enable }, };
static int hns3_get_sset_count(struct net_device *netdev, int stringset)