Unverified Commit 7be2e833 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!8781 HNS3: Supports the configuration of default mc guid



Merge Pull Request from: @mufengyan 
 
HNS3: Supports the configuration of default mc guid

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

-----------------------------------------------------------

The patch deletes the configuration of the bc_guid
because its function is unknown.

To support the function of other groups, the mc_GUID
specified in the protocol is configured during driver
loading.

Signed-off-by: default avatarHaibin Lu <luhaibin10@hisilicon.com>
 
Link:https://gitee.com/openeuler/kernel/pulls/8781

 

Reviewed-by: default avatarLin Yunsheng <linyunsheng@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 64295601 14b1e488
Loading
Loading
Loading
Loading
+24 −7
Original line number Diff line number Diff line
@@ -327,12 +327,21 @@ void hns3_unic_set_rx_mode(struct net_device *netdev)

int hns3_unic_init_guid(struct net_device *netdev)
{
	const u8 bc_guid[HNS3_SIMPLE_GUID_LEN] = {0xff, 0xff, 0xff, 0xff,
						  0xff, 0xff};
	const u8 mc_guid[][HNS3_SIMPLE_GUID_LEN] = {
		{0xff, 0xff, 0xff, 0xff, 0x01, 0x00}, /* DHCPv4 */
		{0xff, 0xff, 0xff, 0xff, 0x01, 0x01}, /* DHCPv6 */
		{0xff, 0xff, 0xff, 0xff, 0x01, 0x02}, /* IP notify */
		{0xff, 0xff, 0xff, 0xff, 0x01, 0x03}, /* ULDP */
		{0xff, 0xff, 0xff, 0xff, 0x01, 0x04}, /* ULAP */
		{0xff, 0xff, 0xff, 0xff, 0x01, 0x05}, /* Time sync */
		{0xff, 0xff, 0xff, 0xff, 0x01, 0x06}, /* NPIC */
		{0xff, 0xff, 0xff, 0xff, 0x01, 0x07}, /* NNP */
		{0xff, 0xff, 0xff, 0xff, 0x01, 0x08}, /* PHCP */
	};
	struct hns3_nic_priv *priv = netdev_priv(netdev);
	struct hnae3_handle *h = priv->ae_handle;
	u8 temp_guid_addr[UBL_ALEN];
	int ret;
	int ret, i;

	if (!h->ae_algo->ops->get_func_guid ||
	    !h->ae_algo->ops->set_func_guid) {
@@ -346,10 +355,12 @@ int hns3_unic_init_guid(struct net_device *netdev)
		return ret;
	}

	ret = hns3_unic_add_mc_guid(netdev, bc_guid);
	for (i = 0; i < ARRAY_SIZE(mc_guid); i++) {
		ret = hns3_unic_add_mc_guid(netdev, mc_guid[i]);
		if (ret) {
			netdev_err(netdev, "add mc guid fail, ret = %d!\n", ret);
		return ret;
			goto err_add_mc_guid;
		}
	}

	memcpy(netdev->dev_addr, temp_guid_addr, netdev->addr_len);
@@ -358,6 +369,12 @@ int hns3_unic_init_guid(struct net_device *netdev)
	h->ae_algo->ops->set_func_guid(h, netdev->dev_addr);

	return 0;

err_add_mc_guid:
	for (i = i - 1; i >= 0; i--)
		(void)hns3_unic_del_mc_guid(netdev, mc_guid[i]);

	return ret;
}

int hns3_unic_fill_skb_desc(struct hns3_nic_priv *priv,