svn commit: r225405 - head/sys/dev/ixgbe

Fabien Thomas fabien.thomas at netasq.com
Tue Sep 6 09:53:37 UTC 2011


On Sep 5, 2011, at 7:54 PM, Qing Li wrote:

> Author: qingli
> Date: Mon Sep  5 17:54:19 2011
> New Revision: 225405
> URL: http://svn.freebsd.org/changeset/base/225405
> 
> Log:
>  The maximum read size of incoming packets is done in 1024-byte increments.
>  The current code was rounding down the maximum frame size instead of
>  routing up, resulting in a read size of 1024 bytes, in the non-jumbo
>  frame case, and splitting the packets across multiple mbufs.

I'm not sure to understand the fix:
        if (adapter->max_frame_size <= 2048)
                adapter->rx_mbuf_sz = MCLBYTES;
        else if (adapter->max_frame_size <= 4096)
                adapter->rx_mbuf_sz = MJUMPAGESIZE;
        else if (adapter->max_frame_size <= 9216)
                adapter->rx_mbuf_sz = MJUM9BYTES;
        else
                adapter->rx_mbuf_sz = MJUM16BYTES;

Without the fix this resolve to

bufsz = adapter->rx_mbuf_sz  >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;

2048 >> 10 = 2 which seem correct regarding the definition:

BSIZEPACKET:
Receive Buffer Size for Packet Buffer. The value is in 1 KB resolution. Value can be from 1 KB to 16 KB. Default buffer size is 2 KB. This field should not be set to 0x0. This field should be greater or equal to 0x2 in queues where RSC is enabled.

I've missed something?

> 
>  Consequently the above problem exposed another issue, which is when
>  packets were splitted across multiple mbufs, and all of the mbufs in the
>  chain have the M_PKTHDR flag set.
> 
>  Submitted by:	original patch by Ray Ruvinskiy at BlueCoat dot com
>  Reviewed by:	jfv, kmacy, rwatson
>  Approved by:	re (rwatson)
>  MFC after:	5 days
> 
> Modified:
>  head/sys/dev/ixgbe/ixgbe.c
> 
> Modified: head/sys/dev/ixgbe/ixgbe.c
> ==============================================================================
> --- head/sys/dev/ixgbe/ixgbe.c	Mon Sep  5 17:45:24 2011	(r225404)
> +++ head/sys/dev/ixgbe/ixgbe.c	Mon Sep  5 17:54:19 2011	(r225405)
> @@ -3849,6 +3849,8 @@ fail:
>  **********************************************************************/
> #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2
> 
> +#define BSIZEPKT_ROUNDUP ((1<<IXGBE_SRRCTL_BSIZEPKT_SHIFT)-1)
> +	
> static void
> ixgbe_initialize_receive_units(struct adapter *adapter)
> {
> @@ -3882,7 +3884,7 @@ ixgbe_initialize_receive_units(struct ad
> 		hlreg &= ~IXGBE_HLREG0_JUMBOEN;
> 	IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg);
> 
> -	bufsz = adapter->rx_mbuf_sz  >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;
> +	bufsz = (adapter->rx_mbuf_sz + BSIZEPKT_ROUNDUP) >> IXGBE_SRRCTL_BSIZEPKT_SHIFT;
> 
> 	for (int i = 0; i < adapter->num_queues; i++, rxr++) {
> 		u64 rdba = rxr->rxdma.dma_paddr;
> @@ -4300,9 +4302,10 @@ ixgbe_rxeof(struct ix_queue *que, int co
> 			sendmp = rbuf->fmp;
> 			rbuf->m_pack = rbuf->fmp = NULL;
> 
> -			if (sendmp != NULL) /* secondary frag */
> +			if (sendmp != NULL) {  /* secondary frag */
> +				mp->m_flags &= ~M_PKTHDR;
> 				sendmp->m_pkthdr.len += mp->m_len;
> -			else {
> +			} else {
> 				/* first desc of a non-ps chain */
> 				sendmp = mp;
> 				sendmp->m_flags |= M_PKTHDR;

--
Fabien Thomas






More information about the svn-src-all mailing list