mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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: Tariq Toukan <tariqt@mellanox.com> Reviewed-by: Saeed Mahameed <saeedm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									f468f21b7a
								
							
						
					
					
						commit
						e20f0dbf20
					
				
					 4 changed files with 11 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -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++;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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++;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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  */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue