Fix frame size calculation when hardware VLAN acceleration is on
Subsystems (2)
PATCH 1/1 Fix the data buffer stashing amount
In reply to Andy FlemingFrom: Dai Haruki <[email protected]>
- Buffer stashing parameter change to 96 from 64 in order to cover the Layer 4 header.
--- drivers/net/gianfar.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/gianfar.h +1 -1
@@ -102,7 +102,7 @@ extern const char gfar_driver_version[];#define DEFAULT_FIFO_TX_STARVE 0x40#define DEFAULT_FIFO_TX_STARVE_OFF 0x80#define DEFAULT_BD_STASH 1 -#define DEFAULT_STASH_LENGTH 64 +#define DEFAULT_STASH_LENGTH 96#define DEFAULT_STASH_INDEX 0/* The number of Exact Match registers */
Signature · 1 line
1.5.4.23.gef5b9
PATCH 1/1 Fix frame size calculation when hardware VLAN acceleration is on
From: Dai Haruki <[email protected]>
In gfar_change_mtu(), the frame size needs to be increased to account for the extra 4 bytes VLAN adds to the ethernet header. However, it was being increased by the length of the whole header (18 bytes), which is wrong.
--- drivers/net/gianfar.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/gianfar.c +1 -1
@@ -1185,7 +1185,7 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)int frame_size = new_mtu +ETH_HLEN ;if (priv->vlan_enable) - frame_size +=VLAN_ETH_HLEN ; + frame_size +=VLAN_HLEN ;if (gfar_uses_fcb (priv)) frame_size +=GMAC_FCB_LEN ;
Signature · 1 line
1.5.4.23.gef5b9
PATCH 1/1 Only process completed frames
If the LAST bit is not set in the RxBD, it's possible we're processing an incomplete frame, which is bad. While we're at it, add a constant for the error bitmask, so the whole if-clause fits on one line, and is more legible.
--- drivers/net/gianfar.c | 4 +--- drivers/net/gianfar.h | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/gianfar.c +1 -3
@@ -1526,9 +1526,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)rmb (); skb = priv->rx_skbuff[priv->skb_currx]; -if (!(bdp->status & - (RXBD_LARGE |RXBD_SHORT |RXBD_NONOCTET - |RXBD_CRCERR |RXBD_OVERRUN |RXBD_TRUNCATED ))) { +if ((bdp->status &RXBD_LAST ) && !(bdp->status &RXBD_ERR )) {/* Increment the number of packets */ dev->stats.rx_packets++; howmany++;
drivers/net/gianfar.h +3 -0
@@ -340,6 +340,9 @@ extern const char gfar_driver_version[];#define RXBD_OVERRUN 0x0002#define RXBD_TRUNCATED 0x0001#define RXBD_STATS 0x01ff +#define RXBD_ERR (RXBD_LARGE | RXBD_SHORT | RXBD_NONOCTET \ + | RXBD_CRCERR | RXBD_OVERRUN \ + | RXBD_TRUNCATED)/* Rx FCB status field bits */ #define RXFCB_VLN 0x8000
Signature · 1 line
1.5.4.23.gef5b9
PATCH 1/1 Fix Rx/Tx HW interrupt coalescing counter reset procedure.
- Fix Rx/Tx HW interrupt coalescing counter reset logic. Disabling is required before resetting the counter.
- Update the Default both Rx and Tx coalescing timer threshold. Formerly 4 is set which is equal to 1.5 frame at the line rate of 1GbE interface, and it doesn't match to the coalescing frame count which is set to 16. Threashold 21 is matched to frame count 16.
--- drivers/net/gianfar.c | 18 +++++++++--------- drivers/net/gianfar.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/net/gianfar.c +9 -9
@@ -1299,11 +1299,11 @@ static irqreturn_t gfar_transmit(int irq, void *dev_id)/* If we are coalescing the interrupts, reset the timer */ /* Otherwise, clear it */ -if (priv->txcoalescing) +if (likely (priv->txcoalescing)) { +gfar_write (&priv->regs->txic,0 );gfar_write (&priv->regs->txic,mk_ic_value (priv->txcount, priv->txtime)); -else -gfar_write (&priv->regs->txic,0 ); + }spin_unlock (&priv->txlock);
@@ -1417,11 +1417,11 @@ irqreturn_t gfar_receive(int irq, void *dev_id)/* If we are coalescing interrupts, update the timer */ /* Otherwise, clear it */ -if (priv->rxcoalescing) +if (likely (priv->rxcoalescing)) { +gfar_write (&priv->regs->rxic,0 );gfar_write (&priv->regs->rxic,mk_ic_value (priv->rxcount, priv->rxtime)); -else -gfar_write (&priv->regs->rxic,0 ); + }spin_unlock_irqrestore (&priv->rxlock, flags);#endif
@@ -1593,11 +1593,11 @@ static int gfar_poll(struct napi_struct *napi, int budget)/* If we are coalescing interrupts, update the timer */ /* Otherwise, clear it */ -if (priv->rxcoalescing) +if (likely (priv->rxcoalescing)) { +gfar_write (&priv->regs->rxic,0 );gfar_write (&priv->regs->rxic,mk_ic_value (priv->rxcount, priv->rxtime)); -else -gfar_write (&priv->regs->rxic,0 ); + } }return howmany;
drivers/net/gianfar.h +2 -2
@@ -124,11 +124,11 @@ extern const char gfar_driver_version[];#define DEFAULT_TX_COALESCE 1#define DEFAULT_TXCOUNT 16 -#define DEFAULT_TXTIME 4 +#define DEFAULT_TXTIME 21#define DEFAULT_RX_COALESCE 1#define DEFAULT_RXCOUNT 16 -#define DEFAULT_RXTIME 4 +#define DEFAULT_RXTIME 21#define TBIPA_VALUE 0x1f#define MIIMCFG_INIT_VALUE 0x00000007
Signature · 1 line
1.5.4.23.gef5b9
Re: [PATCH v2.6.26] Fix the data buffer stashing amount
In reply to Andy FlemingQuoted 8 lines · Andy Fleming
From: Dai Haruki <[email protected]>
- Buffer stashing parameter change to 96 from 64 in order to cover the Layer 4 header.
Signed-off-by Dai Haruki <[email protected]>--- drivers/net/gianfar.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
applied all four patches
Please include a "gianfar: " prefix or similar in your subject line.
After the bracketed info is stripped by automated tools, we are only left with a vague "Fix the data buffer stashing amount" one-line description of your change, with no clue as to what area of the kernel this change applies to