Commit a6d36d56 authored by Ben Menchaca's avatar Ben Menchaca Committed by David S. Miller

gianfar: fix undo of reserve()

Fix undo of reserve() before RX recycle

gfar_new_skb reserve()s space in the SKB to align it.  If an error occurs,
and the skb needs to be returned to the RX recycle queue, the current code
attempts to reset head, but did not reset tail.  This patch remembers the
alignment amount, and reverses the reserve() when needed.
Signed-off-by: default avatarBen Menchaca <ben@bigfootnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent af06393b
...@@ -2393,6 +2393,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev) ...@@ -2393,6 +2393,7 @@ struct sk_buff * gfar_new_skb(struct net_device *dev)
* as many bytes as needed to align the data properly * as many bytes as needed to align the data properly
*/ */
skb_reserve(skb, alignamount); skb_reserve(skb, alignamount);
GFAR_CB(skb)->alignamount = alignamount;
return skb; return skb;
} }
...@@ -2533,13 +2534,13 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit) ...@@ -2533,13 +2534,13 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
newskb = skb; newskb = skb;
else if (skb) { else if (skb) {
/* /*
* We need to reset ->data to what it * We need to un-reserve() the skb to what it
* was before gfar_new_skb() re-aligned * was before gfar_new_skb() re-aligned
* it to an RXBUF_ALIGNMENT boundary * it to an RXBUF_ALIGNMENT boundary
* before we put the skb back on the * before we put the skb back on the
* recycle list. * recycle list.
*/ */
skb->data = skb->head + NET_SKB_PAD; skb_reserve(skb, -GFAR_CB(skb)->alignamount);
__skb_queue_head(&priv->rx_recycle, skb); __skb_queue_head(&priv->rx_recycle, skb);
} }
} else { } else {
......
...@@ -566,6 +566,12 @@ struct rxfcb { ...@@ -566,6 +566,12 @@ struct rxfcb {
u16 vlctl; /* VLAN control word */ u16 vlctl; /* VLAN control word */
}; };
struct gianfar_skb_cb {
int alignamount;
};
#define GFAR_CB(skb) ((struct gianfar_skb_cb *)((skb)->cb))
struct rmon_mib struct rmon_mib
{ {
u32 tr64; /* 0x.680 - Transmit and Receive 64-byte Frame Counter */ u32 tr64; /* 0x.680 - Transmit and Receive 64-byte Frame Counter */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment