forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/ethernet/mellanox/mlx4/en_rx.c
....@@ -31,7 +31,6 @@
3131 *
3232 */
3333
34
-#include <net/busy_poll.h>
3534 #include <linux/bpf.h>
3635 #include <linux/bpf_trace.h>
3736 #include <linux/mlx4/cq.h>
....@@ -44,6 +43,7 @@
4443 #include <linux/vmalloc.h>
4544 #include <linux/irq.h>
4645
46
+#include <net/ip.h>
4747 #if IS_ENABLED(CONFIG_IPV6)
4848 #include <net/ip6_checksum.h>
4949 #endif
....@@ -271,11 +271,8 @@
271271
272272 ring = kzalloc_node(sizeof(*ring), GFP_KERNEL, node);
273273 if (!ring) {
274
- ring = kzalloc(sizeof(*ring), GFP_KERNEL);
275
- if (!ring) {
276
- en_err(priv, "Failed to allocate RX ring structure\n");
277
- return -ENOMEM;
278
- }
274
+ en_err(priv, "Failed to allocate RX ring structure\n");
275
+ return -ENOMEM;
279276 }
280277
281278 ring->prod = 0;
....@@ -686,6 +683,7 @@
686683 rcu_read_lock();
687684 xdp_prog = rcu_dereference(ring->xdp_prog);
688685 xdp.rxq = &ring->xdp_rxq;
686
+ xdp.frame_sz = priv->frag_info[0].frag_stride;
689687 doorbell_pending = 0;
690688
691689 /* We assume a 1:1 mapping between CQEs and Rx descriptors, so Rx
....@@ -707,7 +705,7 @@
707705
708706 frags = ring->rx_info + (index << priv->log_rx_info);
709707 va = page_address(frags[0].page) + frags[0].page_offset;
710
- prefetchw(va);
708
+ net_prefetchw(va);
711709 /*
712710 * make sure we read the CQE after we read the ownership bit
713711 */
....@@ -808,10 +806,10 @@
808806 goto xdp_drop_no_cnt; /* Drop on xmit failure */
809807 default:
810808 bpf_warn_invalid_xdp_action(act);
811
- /* fall through */
809
+ fallthrough;
812810 case XDP_ABORTED:
813811 trace_xdp_exception(dev, xdp_prog, act);
814
- /* fall through */
812
+ fallthrough;
815813 case XDP_DROP:
816814 ring->xdp_drop++;
817815 xdp_drop_no_cnt:
....@@ -893,7 +891,7 @@
893891 skb->data_len = length;
894892 napi_gro_frags(&cq->napi);
895893 } else {
896
- skb->vlan_tci = 0;
894
+ __vlan_hwaccel_clear_tag(skb);
897895 skb_clear_hash(skb);
898896 }
899897 next:
....@@ -952,7 +950,7 @@
952950 xdp_tx_cq = priv->tx_cq[TX_XDP][cq->ring];
953951 if (xdp_tx_cq->xdp_busy) {
954952 clean_complete = mlx4_en_process_tx_cq(dev, xdp_tx_cq,
955
- budget);
953
+ budget) < budget;
956954 xdp_tx_cq->xdp_busy = !clean_complete;
957955 }
958956 }