]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5e: RX, Add a prefetch command for small L1_CACHE_BYTES
authorTariq Toukan <tariqt@mellanox.com>
Wed, 26 Aug 2020 12:54:17 +0000 (15:54 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Aug 2020 22:55:53 +0000 (15:55 -0700)
A single cacheline might not contain the packet header for
small L1_CACHE_BYTES values.
Use net_prefetch() as it issues an additional prefetch
in this case.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c

index 0e6946fc121f0793234b057896de37b988429ac8..4bcb73a5522f1f999a9e8e46a55ca8d068d2a78c 100644 (file)
@@ -201,7 +201,7 @@ static void mlx5e_xdp_mpwqe_session_start(struct mlx5e_xdpsq *sq)
        pi = mlx5e_xdpsq_get_next_pi(sq, MLX5_SEND_WQE_MAX_WQEBBS);
        session->wqe = MLX5E_TX_FETCH_WQE(sq, pi);
 
-       prefetchw(session->wqe->data);
+       net_prefetchw(session->wqe->data);
        session->ds_count  = MLX5E_XDP_TX_EMPTY_DS_COUNT;
        session->pkt_count = 0;
 
@@ -322,7 +322,7 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xdp_xmit_data *xdptxd,
 
        struct mlx5e_xdpsq_stats *stats = sq->stats;
 
-       prefetchw(wqe);
+       net_prefetchw(wqe);
 
        if (unlikely(dma_len < MLX5E_XDP_MIN_INLINE || sq->hw_mtu < dma_len)) {
                stats->err++;
index a33a1f762c70db7d2722984b159e436410fa3e45..786fedf524366f1769a4939b9adfa12427d7e7b6 100644 (file)
@@ -49,7 +49,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq,
        xdp->data_end = xdp->data + cqe_bcnt32;
        xdp_set_data_meta_invalid(xdp);
        xsk_buff_dma_sync_for_cpu(xdp);
-       prefetch(xdp->data);
+       net_prefetch(xdp->data);
 
        rcu_read_lock();
        consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp);
@@ -100,7 +100,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq,
        xdp->data_end = xdp->data + cqe_bcnt;
        xdp_set_data_meta_invalid(xdp);
        xsk_buff_dma_sync_for_cpu(xdp);
-       prefetch(xdp->data);
+       net_prefetch(xdp->data);
 
        if (unlikely(get_cqe_opcode(cqe) != MLX5_CQE_RESP_SEND)) {
                rq->stats->wqe_err++;
index 65828af120b7a63bfd08a8035285032ec75e47fe..228fd775bcd5e48322e1e34e98b43ee02379fb20 100644 (file)
@@ -30,7 +30,6 @@
  * SOFTWARE.
  */
 
-#include <linux/prefetch.h>
 #include <linux/ip.h>
 #include <linux/ipv6.h>
 #include <linux/tcp.h>
@@ -1141,8 +1140,8 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
 
        dma_sync_single_range_for_cpu(rq->pdev, di->addr, wi->offset,
                                      frag_size, DMA_FROM_DEVICE);
-       prefetchw(va); /* xdp_frame data area */
-       prefetch(data);
+       net_prefetchw(va); /* xdp_frame data area */
+       net_prefetch(data);
 
        rcu_read_lock();
        mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt, &xdp);
@@ -1184,7 +1183,7 @@ mlx5e_skb_from_cqe_nonlinear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
                return NULL;
        }
 
-       prefetchw(skb->data);
+       net_prefetchw(skb->data);
 
        while (byte_cnt) {
                u16 frag_consumed_bytes =
@@ -1399,7 +1398,7 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w
                return NULL;
        }
 
-       prefetchw(skb->data);
+       net_prefetchw(skb->data);
 
        if (unlikely(frag_offset >= PAGE_SIZE)) {
                di++;
@@ -1452,8 +1451,8 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
 
        dma_sync_single_range_for_cpu(rq->pdev, di->addr, head_offset,
                                      frag_size, DMA_FROM_DEVICE);
-       prefetchw(va); /* xdp_frame data area */
-       prefetch(data);
+       net_prefetchw(va); /* xdp_frame data area */
+       net_prefetch(data);
 
        rcu_read_lock();
        mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt32, &xdp);
index 46790216ce8637c0940a40e38f640717a8d63ecc..ce8ab1f0187693c8f226a52ab64b75d04f300078 100644 (file)
@@ -30,7 +30,6 @@
  * SOFTWARE.
  */
 
-#include <linux/prefetch.h>
 #include <linux/ip.h>
 #include <linux/udp.h>
 #include <net/udp.h>
@@ -115,7 +114,7 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv)
                return NULL;
        }
 
-       prefetchw(skb->data);
+       net_prefetchw(skb->data);
        skb_reserve(skb, NET_IP_ALIGN);
 
        /*  Reserve for ethernet and IP header  */