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

!11889 UNIC: Invoke the hns3_unic_set_default_cc in advance and modify ublhdr struct

Merge Pull Request from: @mufengyan 
 
UNIC: Invoke the hns3_unic_set_default_cc in advance and modify ublhdr struct

jianqiang Li (2):
  UNIC: The ublhdr structure and UBL_HLEN macro are modified
  UNIC: Invoke the hns3_unic_set_default_cc in advance

 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c |  4 ++--
 drivers/net/ub/dev/ubl.c                        | 16 +++++-----------
 drivers/net/ub/dev/ubl.h                        |  9 ++++++++-
 3 files changed, 15 insertions(+), 14 deletions(-) 
 
Link:https://gitee.com/openeuler/kernel/pulls/11889

 

Reviewed-by: default avatarLin Yunsheng <linyunsheng@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parents 7e10ffab cd1dc96a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2618,10 +2618,10 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev)
	}
#ifdef CONFIG_HNS3_UBL
	if (hns3_ubl_supported(hns3_get_handle(netdev))) {
		hns3_unic_set_default_cc(skb);

		if (unlikely(!ubl_rmv_sw_ctype(skb)))
			goto out_err_tx_ok;

		hns3_unic_set_default_cc(skb);
	}
#endif
	if (test_bit(HNAE3_PFLAG_ROH_ARP_PROXY_ENABLE,
+5 −11
Original line number Diff line number Diff line
@@ -84,25 +84,19 @@ static int ubl_create_header(struct sk_buff *skb, struct net_device *dev,
			     unsigned short type, const void *daddr,
			     const void *saddr, unsigned int len)
{
	u8 ctype = UB_NOIP_CFG_TYPE;
	int ret = -UBL_HLEN;
	struct ublhdr *ubl;

	if (type == ETH_P_IP || type == ETH_P_IPV6) {
		ubl = (struct ublhdr *)skb_push(skb, UBL_HLEN);
		memset(ubl, 0, sizeof(struct ublhdr));
		ubl->h_npi = htonl(UB_DEFAULT_NPI);
		ctype = (type == ETH_P_IP) ? UB_IPV4_CFG_TYPE : UB_IPV6_CFG_TYPE;
		ret = UBL_HLEN;
		ubl->cfg = (type == ETH_P_IP) ? UB_IPV4_CFG_TYPE : UB_IPV6_CFG_TYPE;
		return UBL_HLEN;
	} else if (type == ETH_P_UB) {
		/* if type is ETH_P_UB, then do nothing. */
		ret = 0;
		return 0;
	}

	if (ubl_add_sw_ctype(skb, ctype))
		ret = -ENOMEM;

	return ret;
	return -UBL_HLEN;
}

/**
@@ -184,7 +178,7 @@ __be16 ubl_type_trans(struct sk_buff *skb, struct net_device *dev, u8 type)

	skb_reset_mac_header(skb);
	if (type == UB_IPV4_CFG_TYPE || type == UB_IPV6_CFG_TYPE)
		skb_pull_inline(skb, UBL_HLEN + 1);
		skb_pull_inline(skb, UBL_HLEN);
	else if (type != UB_NOIP_CFG_TYPE)
		net_warn_ratelimited("An unknown packet is received by %s, type is %u\n",
				     dev->name, type);
+8 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
#define UBL_MOD_VERSION "1.0.0"

#define UBL_HARD_HLEN		4
#define UBL_HLEN		6
#define UBL_HLEN		7
#define UBL_ALEN		16

#define UBL_LCRC_LEN		2
@@ -55,6 +55,13 @@
 *	@h_npi: network partition identifier
 */
struct ublhdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
	u8     cfg : 4;
	u8     resv : 4;
#else
	u8     resv : 4;
	u8     cfg : 4;
#endif
	__be16 h_cc;
	__be32 h_npi;
} __packed;