Commit e8149933 authored by Yunsheng Lin's avatar Yunsheng Lin Committed by David S. Miller

net: hns3: remove hnae3_get_bit in data path

The hnae3_get_bit uses hnae3_get_field, and hnae3_get_field
masks the data, which is unnecessary in data path.
Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cde4ffad
...@@ -2318,13 +2318,12 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb, ...@@ -2318,13 +2318,12 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
} }
/* check if hardware has done checksum */ /* check if hardware has done checksum */
if (!hnae3_get_bit(bd_base_info, HNS3_RXD_L3L4P_B)) if (!(bd_base_info & BIT(HNS3_RXD_L3L4P_B)))
return; return;
if (unlikely(hnae3_get_bit(l234info, HNS3_RXD_L3E_B) || if (unlikely(l234info & (BIT(HNS3_RXD_L3E_B) | BIT(HNS3_RXD_L4E_B) ||
hnae3_get_bit(l234info, HNS3_RXD_L4E_B) || BIT(HNS3_RXD_OL3E_B) ||
hnae3_get_bit(l234info, HNS3_RXD_OL3E_B) || BIT(HNS3_RXD_OL4E_B)))) {
hnae3_get_bit(l234info, HNS3_RXD_OL4E_B))) {
u64_stats_update_begin(&ring->syncp); u64_stats_update_begin(&ring->syncp);
ring->stats.l3l4_csum_err++; ring->stats.l3l4_csum_err++;
u64_stats_update_end(&ring->syncp); u64_stats_update_end(&ring->syncp);
...@@ -2469,11 +2468,11 @@ static int hns3_add_frag(struct hns3_enet_ring *ring, struct hns3_desc *desc, ...@@ -2469,11 +2468,11 @@ static int hns3_add_frag(struct hns3_enet_ring *ring, struct hns3_desc *desc,
bd_base_info = le32_to_cpu(desc->rx.bd_base_info); bd_base_info = le32_to_cpu(desc->rx.bd_base_info);
} }
while (!hnae3_get_bit(bd_base_info, HNS3_RXD_FE_B)) { while (!(bd_base_info & BIT(HNS3_RXD_FE_B))) {
desc = &ring->desc[ring->next_to_clean]; desc = &ring->desc[ring->next_to_clean];
desc_cb = &ring->desc_cb[ring->next_to_clean]; desc_cb = &ring->desc_cb[ring->next_to_clean];
bd_base_info = le32_to_cpu(desc->rx.bd_base_info); bd_base_info = le32_to_cpu(desc->rx.bd_base_info);
if (!hnae3_get_bit(bd_base_info, HNS3_RXD_VLD_B)) if (!(bd_base_info & BIT(HNS3_RXD_VLD_B)))
return -ENXIO; return -ENXIO;
if (unlikely(ring->frag_num >= MAX_SKB_FRAGS)) { if (unlikely(ring->frag_num >= MAX_SKB_FRAGS)) {
...@@ -2587,7 +2586,7 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, ...@@ -2587,7 +2586,7 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring,
bd_base_info = le32_to_cpu(desc->rx.bd_base_info); bd_base_info = le32_to_cpu(desc->rx.bd_base_info);
/* Check valid BD */ /* Check valid BD */
if (unlikely(!hnae3_get_bit(bd_base_info, HNS3_RXD_VLD_B))) if (unlikely(!(bd_base_info & BIT(HNS3_RXD_VLD_B))))
return -ENXIO; return -ENXIO;
if (!skb) if (!skb)
...@@ -2650,7 +2649,7 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, ...@@ -2650,7 +2649,7 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring,
vlan_tag); vlan_tag);
} }
if (unlikely(!hnae3_get_bit(bd_base_info, HNS3_RXD_VLD_B))) { if (unlikely(!(bd_base_info & BIT(HNS3_RXD_VLD_B)))) {
u64_stats_update_begin(&ring->syncp); u64_stats_update_begin(&ring->syncp);
ring->stats.non_vld_descs++; ring->stats.non_vld_descs++;
u64_stats_update_end(&ring->syncp); u64_stats_update_end(&ring->syncp);
...@@ -2660,8 +2659,12 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, ...@@ -2660,8 +2659,12 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring,
} }
if (unlikely((!desc->rx.pkt_len) || if (unlikely((!desc->rx.pkt_len) ||
hnae3_get_bit(l234info, HNS3_RXD_TRUNCAT_B))) { (l234info & (BIT(HNS3_RXD_TRUNCAT_B) |
BIT(HNS3_RXD_L2E_B))))) {
u64_stats_update_begin(&ring->syncp); u64_stats_update_begin(&ring->syncp);
if (l234info & BIT(HNS3_RXD_L2E_B))
ring->stats.l2_err++;
else
ring->stats.err_pkt_len++; ring->stats.err_pkt_len++;
u64_stats_update_end(&ring->syncp); u64_stats_update_end(&ring->syncp);
...@@ -2669,14 +2672,6 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring, ...@@ -2669,14 +2672,6 @@ static int hns3_handle_rx_bd(struct hns3_enet_ring *ring,
return -EFAULT; return -EFAULT;
} }
if (unlikely(hnae3_get_bit(l234info, HNS3_RXD_L2E_B))) {
u64_stats_update_begin(&ring->syncp);
ring->stats.l2_err++;
u64_stats_update_end(&ring->syncp);
dev_kfree_skb_any(skb);
return -EFAULT;
}
l2_frame_type = hnae3_get_field(l234info, HNS3_RXD_DMAC_M, l2_frame_type = hnae3_get_field(l234info, HNS3_RXD_DMAC_M,
HNS3_RXD_DMAC_S); HNS3_RXD_DMAC_S);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment