diff options
Diffstat (limited to 'drivers/net/ethernet/intel/i40e/i40e_txrx.c')
| -rw-r--r-- | drivers/net/ethernet/intel/i40e/i40e_txrx.c | 41 | 
1 files changed, 13 insertions, 28 deletions
| diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 627794b31e33..121cd99fdeff 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -1570,17 +1570,6 @@ void i40e_free_rx_resources(struct i40e_ring *rx_ring)  }  /** - * i40e_rx_offset - Return expected offset into page to access data - * @rx_ring: Ring we are requesting offset of - * - * Returns the offset value for ring into the data buffer. - */ -static unsigned int i40e_rx_offset(struct i40e_ring *rx_ring) -{ -	return ring_uses_build_skb(rx_ring) ? I40E_SKB_PAD : 0; -} - -/**   * i40e_setup_rx_descriptors - Allocate Rx descriptors   * @rx_ring: Rx descriptor ring (for a specific queue) to setup   * @@ -1608,7 +1597,6 @@ int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring)  	rx_ring->next_to_alloc = 0;  	rx_ring->next_to_clean = 0;  	rx_ring->next_to_use = 0; -	rx_ring->rx_offset = i40e_rx_offset(rx_ring);  	/* XDP RX-queue info only needed for RX rings exposed to XDP */  	if (rx_ring->vsi->type == I40E_VSI_MAIN) { @@ -2307,8 +2295,7 @@ int i40e_xmit_xdp_tx_ring(struct xdp_buff *xdp, struct i40e_ring *xdp_ring)   * @rx_ring: Rx ring being processed   * @xdp: XDP buffer containing the frame   **/ -static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring, -				    struct xdp_buff *xdp) +static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp)  {  	int err, result = I40E_XDP_PASS;  	struct i40e_ring *xdp_ring; @@ -2347,7 +2334,7 @@ static struct sk_buff *i40e_run_xdp(struct i40e_ring *rx_ring,  	}  xdp_out:  	rcu_read_unlock(); -	return ERR_PTR(-result); +	return result;  }  /** @@ -2460,6 +2447,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)  	unsigned int xdp_xmit = 0;  	bool failure = false;  	struct xdp_buff xdp; +	int xdp_res = 0;  #if (PAGE_SIZE < 8192)  	frame_sz = i40e_rx_frame_truesize(rx_ring, 0); @@ -2525,12 +2513,10 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)  			/* At larger PAGE_SIZE, frame_sz depend on len size */  			xdp.frame_sz = i40e_rx_frame_truesize(rx_ring, size);  #endif -			skb = i40e_run_xdp(rx_ring, &xdp); +			xdp_res = i40e_run_xdp(rx_ring, &xdp);  		} -		if (IS_ERR(skb)) { -			unsigned int xdp_res = -PTR_ERR(skb); - +		if (xdp_res) {  			if (xdp_res & (I40E_XDP_TX | I40E_XDP_REDIR)) {  				xdp_xmit |= xdp_res;  				i40e_rx_buffer_flip(rx_ring, rx_buffer, size); @@ -3345,7 +3331,7 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,  }  /** - * i40e_create_tx_ctx Build the Tx context descriptor + * i40e_create_tx_ctx - Build the Tx context descriptor   * @tx_ring:  ring to create the descriptor on   * @cd_type_cmd_tso_mss: Quad Word 1   * @cd_tunneling: Quad Word 0 - bits 0-31 @@ -3847,8 +3833,8 @@ netdev_tx_t i40e_lan_xmit_frame(struct sk_buff *skb, struct net_device *netdev)   * @frames: array of XDP buffer pointers   * @flags: XDP extra info   * - * Returns number of frames successfully sent. Frames that fail are - * free'ed via XDP return API. + * Returns number of frames successfully sent. Failed frames + * will be free'ed by XDP core.   *   * For error cases, a negative errno code is returned and no-frames   * are transmitted (caller must handle freeing frames). @@ -3861,7 +3847,7 @@ int i40e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,  	struct i40e_vsi *vsi = np->vsi;  	struct i40e_pf *pf = vsi->back;  	struct i40e_ring *xdp_ring; -	int drops = 0; +	int nxmit = 0;  	int i;  	if (test_bit(__I40E_VSI_DOWN, vsi->state)) @@ -3881,14 +3867,13 @@ int i40e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,  		int err;  		err = i40e_xmit_xdp_ring(xdpf, xdp_ring); -		if (err != I40E_XDP_TX) { -			xdp_return_frame_rx_napi(xdpf); -			drops++; -		} +		if (err != I40E_XDP_TX) +			break; +		nxmit++;  	}  	if (unlikely(flags & XDP_XMIT_FLUSH))  		i40e_xdp_ring_update_tail(xdp_ring); -	return n - drops; +	return nxmit;  } | 
