Commit 7be26f9c authored by Peiyang Wang's avatar Peiyang Wang Committed by Jiantao Xiao
Browse files

net: hns3: arp cleancode

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8M1F3


CVE: NA

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

The hns3_roh_arp_reply_idx_move_fd(idx) macro is added in an incorrect
way. As a result, the logic does not meet the expectation and the
NETDEV_TX_BUSY message is repeatedly reported.

Fixes: 0b68f477 ("net: hns3: support arp proxy")
Signed-off-by: default avatarPeiyang Wang <wangpeiyang1@huawei.com>
Signed-off-by: default avatarJiantao Xiao <xiaojiantao1@h-partners.com>
parent 94b41cc2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ int hns3_handle_roh_arp_req(struct sk_buff *skb, struct hns3_nic_priv *priv)
	/* use same queue num in rx */
	ring = &priv->ring[skb->queue_mapping + h->kinfo.num_tqps];
	reply_idx = ring->arp_reply_tail;
	hns3_roh_arp_reply_idx_move_fd(reply_idx);
	reply_idx = hns3_roh_arp_reply_idx_move_fd(reply_idx);
	/* This smp_load_acquire() pairs with smp_store_release() in
	 * hns3_handle_roh_arp_reply().
	 */
@@ -150,7 +150,7 @@ void hns3_handle_roh_arp_reply(struct hns3_enet_tqp_vector *tqp_vector,
		while (smp_load_acquire(&ring->arp_reply_tail) !=
		       ring->arp_reply_head) {
			reply_idx = ring->arp_reply_head;
			hns3_roh_arp_reply_idx_move_fd(reply_idx);
			reply_idx = hns3_roh_arp_reply_idx_move_fd(reply_idx);
			arp_reply = &ring->arp_reply[reply_idx];
			skb = setup_arp_reply_skb(arp_reply, priv);
			/* This smp_store_release() pairs with
+4 −3
Original line number Diff line number Diff line
@@ -13,9 +13,10 @@
	u64_to_ether_addr((ip_addr) & HNS3_ROH_MAC_ADDR_MASK, mac)
#define hns3_roh_arp_hlen_max(skb) \
	(ETH_HLEN + arp_hdr_len((skb)->dev) + VLAN_HLEN)
#define hns3_roh_arp_reply_idx_move_fd(idx) \
	({ typeof(idx) x_ = (idx); \
	   x_ = (x_ + 1) % HNS3_APR_REPLY_LTH; })
static inline int hns3_roh_arp_reply_idx_move_fd(int idx)
{
	return (idx + 1) % HNS3_APR_REPLY_LTH;
}

void hns3_handle_roh_arp_reply(struct hns3_enet_tqp_vector *tqp_vector,
			       struct hns3_nic_priv *priv);