diff options
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_main.c')
| -rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 58 | 
1 files changed, 33 insertions, 25 deletions
| diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 878b31d534ec..038a9fd1af44 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -1921,8 +1921,8 @@ static void igb_setup_tx_mode(struct igb_adapter *adapter)  		 */  		val = rd32(E1000_TXPBS);  		val &= ~I210_TXPBSIZE_MASK; -		val |= I210_TXPBSIZE_PB0_8KB | I210_TXPBSIZE_PB1_8KB | -			I210_TXPBSIZE_PB2_4KB | I210_TXPBSIZE_PB3_4KB; +		val |= I210_TXPBSIZE_PB0_6KB | I210_TXPBSIZE_PB1_6KB | +			I210_TXPBSIZE_PB2_6KB | I210_TXPBSIZE_PB3_6KB;  		wr32(E1000_TXPBS, val);  		val = rd32(E1000_RXPBS); @@ -2037,7 +2037,7 @@ static void igb_power_down_link(struct igb_adapter *adapter)  }  /** - * Detect and switch function for Media Auto Sense + * igb_check_swap_media -  Detect and switch function for Media Auto Sense   * @adapter: address of the board private structure   **/  static void igb_check_swap_media(struct igb_adapter *adapter) @@ -2934,7 +2934,7 @@ static int igb_xdp_xmit(struct net_device *dev, int n,  	int cpu = smp_processor_id();  	struct igb_ring *tx_ring;  	struct netdev_queue *nq; -	int drops = 0; +	int nxmit = 0;  	int i;  	if (unlikely(test_bit(__IGB_DOWN, &adapter->state))) @@ -2961,10 +2961,9 @@ static int igb_xdp_xmit(struct net_device *dev, int n,  		int err;  		err = igb_xmit_xdp_ring(adapter, tx_ring, xdpf); -		if (err != IGB_XDP_TX) { -			xdp_return_frame_rx_napi(xdpf); -			drops++; -		} +		if (err != IGB_XDP_TX) +			break; +		nxmit++;  	}  	__netif_tx_unlock(nq); @@ -2972,7 +2971,7 @@ static int igb_xdp_xmit(struct net_device *dev, int n,  	if (unlikely(flags & XDP_XMIT_FLUSH))  		igb_xdp_ring_update_tail(tx_ring); -	return n - drops; +	return nxmit;  }  static const struct net_device_ops igb_netdev_ops = { @@ -3115,7 +3114,7 @@ static s32 igb_init_i2c(struct igb_adapter *adapter)  		return 0;  	/* Initialize the i2c bus which is controlled by the registers. -	 * This bus will use the i2c_algo_bit structue that implements +	 * This bus will use the i2c_algo_bit structure that implements  	 * the protocol through toggling of the 4 bits in the register.  	 */  	adapter->i2c_adap.owner = THIS_MODULE; @@ -4020,7 +4019,7 @@ static int igb_sw_init(struct igb_adapter *adapter)  }  /** - *  igb_open - Called when a network interface is made active + *  __igb_open - Called when a network interface is made active   *  @netdev: network interface device structure   *  @resuming: indicates whether we are in a resume call   * @@ -4138,7 +4137,7 @@ int igb_open(struct net_device *netdev)  }  /** - *  igb_close - Disables a network interface + *  __igb_close - Disables a network interface   *  @netdev: network interface device structure   *  @suspending: indicates we are in a suspend call   * @@ -5856,7 +5855,7 @@ static void igb_tx_ctxtdesc(struct igb_ring *tx_ring,  	 */  	if (tx_ring->launchtime_enable) {  		ts = ktime_to_timespec64(first->skb->tstamp); -		first->skb->tstamp = ktime_set(0, 0); +		skb_txtime_consumed(first->skb);  		context_desc->seqnum_seed = cpu_to_le32(ts.tv_nsec / 32);  	} else {  		context_desc->seqnum_seed = 0; @@ -8214,7 +8213,8 @@ static void igb_reuse_rx_page(struct igb_ring *rx_ring,  	new_buff->pagecnt_bias	= old_buff->pagecnt_bias;  } -static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer) +static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer, +				  int rx_buf_pgcnt)  {  	unsigned int pagecnt_bias = rx_buffer->pagecnt_bias;  	struct page *page = rx_buffer->page; @@ -8225,7 +8225,7 @@ static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer)  #if (PAGE_SIZE < 8192)  	/* if we are only owner of page we can reuse it */ -	if (unlikely((page_ref_count(page) - pagecnt_bias) > 1)) +	if (unlikely((rx_buf_pgcnt - pagecnt_bias) > 1))  		return false;  #else  #define IGB_LAST_OFFSET \ @@ -8301,9 +8301,10 @@ static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring,  		return NULL;  	if (unlikely(igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP))) { -		igb_ptp_rx_pktstamp(rx_ring->q_vector, xdp->data, skb); -		xdp->data += IGB_TS_HDR_LEN; -		size -= IGB_TS_HDR_LEN; +		if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, xdp->data, skb)) { +			xdp->data += IGB_TS_HDR_LEN; +			size -= IGB_TS_HDR_LEN; +		}  	}  	/* Determine available headroom for copy */ @@ -8364,8 +8365,8 @@ static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring,  	/* pull timestamp out of packet data */  	if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) { -		igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb); -		__skb_pull(skb, IGB_TS_HDR_LEN); +		if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb)) +			__skb_pull(skb, IGB_TS_HDR_LEN);  	}  	/* update buffer offset */ @@ -8614,11 +8615,17 @@ static unsigned int igb_rx_offset(struct igb_ring *rx_ring)  }  static struct igb_rx_buffer *igb_get_rx_buffer(struct igb_ring *rx_ring, -					       const unsigned int size) +					       const unsigned int size, int *rx_buf_pgcnt)  {  	struct igb_rx_buffer *rx_buffer;  	rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean]; +	*rx_buf_pgcnt = +#if (PAGE_SIZE < 8192) +		page_count(rx_buffer->page); +#else +		0; +#endif  	prefetchw(rx_buffer->page);  	/* we are reusing so sync this buffer for CPU use */ @@ -8634,9 +8641,9 @@ static struct igb_rx_buffer *igb_get_rx_buffer(struct igb_ring *rx_ring,  }  static void igb_put_rx_buffer(struct igb_ring *rx_ring, -			      struct igb_rx_buffer *rx_buffer) +			      struct igb_rx_buffer *rx_buffer, int rx_buf_pgcnt)  { -	if (igb_can_reuse_rx_page(rx_buffer)) { +	if (igb_can_reuse_rx_page(rx_buffer, rx_buf_pgcnt)) {  		/* hand second half of page back to the ring */  		igb_reuse_rx_page(rx_ring, rx_buffer);  	} else { @@ -8664,6 +8671,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)  	unsigned int xdp_xmit = 0;  	struct xdp_buff xdp;  	u32 frame_sz = 0; +	int rx_buf_pgcnt;  	/* Frame size depend on rx_ring setup when PAGE_SIZE=4K */  #if (PAGE_SIZE < 8192) @@ -8693,7 +8701,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)  		 */  		dma_rmb(); -		rx_buffer = igb_get_rx_buffer(rx_ring, size); +		rx_buffer = igb_get_rx_buffer(rx_ring, size, &rx_buf_pgcnt);  		/* retrieve a buffer from the ring */  		if (!skb) { @@ -8736,7 +8744,7 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)  			break;  		} -		igb_put_rx_buffer(rx_ring, rx_buffer); +		igb_put_rx_buffer(rx_ring, rx_buffer, rx_buf_pgcnt);  		cleaned_count++;  		/* fetch next buffer in frame if non-eop */ | 
