Commit e20f0dbf authored by Tariq Toukan's avatar Tariq Toukan Committed by David S. Miller

net/mlx5e: RX, Add a prefetch command for small L1_CACHE_BYTES

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: default avatarTariq Toukan <tariqt@mellanox.com>
Reviewed-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f468f21b
...@@ -201,7 +201,7 @@ static void mlx5e_xdp_mpwqe_session_start(struct mlx5e_xdpsq *sq) ...@@ -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); pi = mlx5e_xdpsq_get_next_pi(sq, MLX5_SEND_WQE_MAX_WQEBBS);
session->wqe = MLX5E_TX_FETCH_WQE(sq, pi); 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->ds_count = MLX5E_XDP_TX_EMPTY_DS_COUNT;
session->pkt_count = 0; session->pkt_count = 0;
...@@ -322,7 +322,7 @@ mlx5e_xmit_xdp_frame(struct mlx5e_xdpsq *sq, struct mlx5e_xdp_xmit_data *xdptxd, ...@@ -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; 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)) { if (unlikely(dma_len < MLX5E_XDP_MIN_INLINE || sq->hw_mtu < dma_len)) {
stats->err++; stats->err++;
......
...@@ -49,7 +49,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, ...@@ -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->data_end = xdp->data + cqe_bcnt32;
xdp_set_data_meta_invalid(xdp); xdp_set_data_meta_invalid(xdp);
xsk_buff_dma_sync_for_cpu(xdp); xsk_buff_dma_sync_for_cpu(xdp);
prefetch(xdp->data); net_prefetch(xdp->data);
rcu_read_lock(); rcu_read_lock();
consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp); 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, ...@@ -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->data_end = xdp->data + cqe_bcnt;
xdp_set_data_meta_invalid(xdp); xdp_set_data_meta_invalid(xdp);
xsk_buff_dma_sync_for_cpu(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)) { if (unlikely(get_cqe_opcode(cqe) != MLX5_CQE_RESP_SEND)) {
rq->stats->wqe_err++; rq->stats->wqe_err++;
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
* SOFTWARE. * SOFTWARE.
*/ */
#include <linux/prefetch.h>
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/ipv6.h> #include <linux/ipv6.h>
#include <linux/tcp.h> #include <linux/tcp.h>
...@@ -1141,8 +1140,8 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, ...@@ -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, dma_sync_single_range_for_cpu(rq->pdev, di->addr, wi->offset,
frag_size, DMA_FROM_DEVICE); frag_size, DMA_FROM_DEVICE);
prefetchw(va); /* xdp_frame data area */ net_prefetchw(va); /* xdp_frame data area */
prefetch(data); net_prefetch(data);
rcu_read_lock(); rcu_read_lock();
mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt, &xdp); 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, ...@@ -1184,7 +1183,7 @@ mlx5e_skb_from_cqe_nonlinear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
return NULL; return NULL;
} }
prefetchw(skb->data); net_prefetchw(skb->data);
while (byte_cnt) { while (byte_cnt) {
u16 frag_consumed_bytes = u16 frag_consumed_bytes =
...@@ -1399,7 +1398,7 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w ...@@ -1399,7 +1398,7 @@ mlx5e_skb_from_cqe_mpwrq_nonlinear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *w
return NULL; return NULL;
} }
prefetchw(skb->data); net_prefetchw(skb->data);
if (unlikely(frag_offset >= PAGE_SIZE)) { if (unlikely(frag_offset >= PAGE_SIZE)) {
di++; di++;
...@@ -1452,8 +1451,8 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, ...@@ -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, dma_sync_single_range_for_cpu(rq->pdev, di->addr, head_offset,
frag_size, DMA_FROM_DEVICE); frag_size, DMA_FROM_DEVICE);
prefetchw(va); /* xdp_frame data area */ net_prefetchw(va); /* xdp_frame data area */
prefetch(data); net_prefetch(data);
rcu_read_lock(); rcu_read_lock();
mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt32, &xdp); mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt32, &xdp);
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
* SOFTWARE. * SOFTWARE.
*/ */
#include <linux/prefetch.h>
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/udp.h> #include <linux/udp.h>
#include <net/udp.h> #include <net/udp.h>
...@@ -115,7 +114,7 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv) ...@@ -115,7 +114,7 @@ static struct sk_buff *mlx5e_test_get_udp_skb(struct mlx5e_priv *priv)
return NULL; return NULL;
} }
prefetchw(skb->data); net_prefetchw(skb->data);
skb_reserve(skb, NET_IP_ALIGN); skb_reserve(skb, NET_IP_ALIGN);
/* Reserve for ethernet and IP header */ /* Reserve for ethernet and IP header */
......
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