Unverified Commit 589871dc authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!2872 net: hns3: Backport some mainline feature and some hns3 bugfix

Merge Pull Request from: @svishen 
 
This pr add support some feature and fix some hns3 bugfix

(1)The arp request for find the mac of a ip is not necessary to send to network. The driver can generate a response arp to the protocol stack based on  mapping relationship. The scope of ARP proxy include all ARP request message including vlan, except free ARP request and tunnel message.
(2)Add HCLGE_SUPPORT_50G_R1_BIT and HCLGE_SUPPORT_100G_R2_BIT two capability bits and Corresponding link modes.
(3)Use cpuhp_state_remove_instance_nocalls() instead of cpuhp_state_remove_instance() so that the notifiers don't execute after the PMU device has been unregistered.
(4)Fix add VLAN fail issue
(5)In hclgevf_mbx_handler() and hclgevf_get_mbx_resp() functions, there is a typical store-store and load-load scenario between received_resp and additional_info. Add barrier to fix it.
(6)The FEC capability bit is default set for device version V2. It's incorrect for the copper port. Eventhough it doesn't make the nic work abnormal, but the capability information display in debugfs may confuse user. So clear it when driver get the port type inforamtion.
(7)The hns3 driver define an array of string to show the coalesce info, but if the kernel adds a new mode or a new state, out-of-bounds access may occur when coalesce info is read via debugfs
(8)fix VF reset fail issue
(9)fix VF wrong speed and duplex issue

issue:
https://gitee.com/openeuler/kernel/issues/I8GQDK
https://gitee.com/openeuler/kernel/issues/I8E4FG
https://gitee.com/openeuler/kernel/issues/I8E4XS
https://gitee.com/openeuler/kernel/issues/I8GVK7
 
 
Link:https://gitee.com/openeuler/kernel/pulls/2872

 

Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents cea0a614 998b0ab9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ obj-$(CONFIG_HNS3) += hnae3.o

obj-$(CONFIG_HNS3_ENET) += hns3.o
hns3-objs = hns3_enet.o hns3_ethtool.o hns3_debugfs.o
hns3-objs += hns3_ext.o
hns3-objs += hns3_ext.o hns3_roh.o

hns3-$(CONFIG_HNS3_DCB) += hns3_dcbnl.o
hns3-$(CONFIG_HNS3_UBL) += hns3_unic.o hns3_unic_debugfs.o
+1 −0
Original line number Diff line number Diff line
@@ -984,6 +984,7 @@ enum hnae3_pflag {
	HNAE3_PFLAG_LIMIT_PROMISC,
	HNAE3_PFLAG_PUSH_ENABLE,
	HNAE3_PFLAG_FD_QB_ENABLE,
	HNAE3_PFLAG_ROH_ARP_PROXY_ENABLE,
	HNAE3_PFLAG_MAX
};

+6 −3
Original line number Diff line number Diff line
@@ -505,11 +505,14 @@ static void hns3_get_coal_info(struct hns3_enet_tqp_vector *tqp_vector,
	}

	sprintf(result[j++], "%d", i);
	sprintf(result[j++], "%s", dim_state_str[dim->state]);
	sprintf(result[j++], "%s", dim->state < ARRAY_SIZE(dim_state_str) ?
		dim_state_str[dim->state] : "unknown");
	sprintf(result[j++], "%u", dim->profile_ix);
	sprintf(result[j++], "%s", dim_cqe_mode_str[dim->mode]);
	sprintf(result[j++], "%s", dim->mode < ARRAY_SIZE(dim_cqe_mode_str) ?
		dim_cqe_mode_str[dim->mode] : "unknown");
	sprintf(result[j++], "%s",
		dim_tune_stat_str[dim->tune_state]);
		dim->tune_state < ARRAY_SIZE(dim_tune_stat_str) ?
		dim_tune_stat_str[dim->tune_state] : "unknown");
	sprintf(result[j++], "%u", dim->steps_left);
	sprintf(result[j++], "%u", dim->steps_right);
	sprintf(result[j++], "%u", dim->tired);
+16 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include "hnae3_ext.h"
#include "hns3_enet.h"
#include "hns3_unic.h"
#include "hns3_roh.h"
/* All hns3 tracepoints are defined by the include below, which
 * must be included exactly once across the whole kernel with
 * CREATE_TRACE_POINTS defined
@@ -2588,6 +2589,11 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
		hns3_unic_set_default_cc(skb);
	}
#endif
	if (test_bit(HNAE3_PFLAG_ROH_ARP_PROXY_ENABLE,
		     &priv->ae_handle->priv_flags) &&
	    hns3_need_to_handle_roh_arp_req(skb))
		return hns3_handle_roh_arp_req(skb, priv);

	ret = hns3_handle_skb_desc(priv, ring, skb, desc_cb, ring->next_to_use);
	if (unlikely(ret <= 0))
		goto out_err_tx_ok;
@@ -4821,6 +4827,9 @@ static int hns3_nic_common_poll(struct napi_struct *napi, int budget)
	if (tqp_vector->num_tqps > 1)
		rx_budget = max(budget / tqp_vector->num_tqps, 1);

	if (hnae3_check_roh_mac_type(priv->ae_handle))
		hns3_handle_roh_arp_reply(tqp_vector, priv);

	hns3_for_each_ring(ring, tqp_vector->rx_group) {
		int rx_cleaned = hns3_clean_rx_ring(ring, rx_budget,
						    hns3_rx_skb);
@@ -5475,7 +5484,7 @@ static int hns3_init_mac_addr(struct net_device *netdev)
	struct hns3_nic_priv *priv = netdev_priv(netdev);
	char format_mac_addr[HNAE3_FORMAT_MAC_ADDR_LEN];
	struct hnae3_handle *h = priv->ae_handle;
	u8 mac_addr_temp[ETH_ALEN];
	u8 mac_addr_temp[ETH_ALEN] = {0};
	int ret = 0;

	if (hns3_ubl_supported(h))
@@ -5621,6 +5630,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)
+14 −0
Original line number Diff line number Diff line
@@ -471,6 +471,15 @@ struct hns3_tx_spare {
	u32 len;
};

struct hns3_arp_reply {
	__be32 dest_ip;
	__be32 src_ip;
	u8 dest_hw[ETH_ALEN];
	u8 src_hw[ETH_ALEN];
	u8 has_vlan;
	__be16 vlan_tci;
};

struct hns3_enet_ring {
	struct hns3_desc *desc; /* dma map address space */
	struct hns3_desc_cb *desc_cb;
@@ -496,6 +505,11 @@ struct hns3_enet_ring {
	int next_to_clean;
	u32 flag;          /* ring attribute */

#define HNS3_APR_REPLY_LTH 32
	struct hns3_arp_reply arp_reply[HNS3_APR_REPLY_LTH];
	int arp_reply_head;
	int arp_reply_tail;

	int pending_buf;
	union {
		/* for Tx ring */
Loading