aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar.c
diff options
context:
space:
mode:
authorOliver Hartkopp <socketcan@hartkopp.net>2010-08-17 04:59:14 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 03:08:30 -0400
commit2244d07bfa2097cb00600da91c715a8aa547917e (patch)
tree44d67d9ffba3697fffeb05c13e88aa76ebc3fd4a /drivers/net/gianfar.c
parent4d5870ec103e6569851b9710f0093f072b08439a (diff)
net: simplify flags for tx timestamping
This patch removes the abstraction introduced by the union skb_shared_tx in the shared skb data. The access of the different union elements at several places led to some confusion about accessing the shared tx_flags e.g. in skb_orphan_try(). http://marc.info/?l=linux-netdev&m=128084897415886&w=2 Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar.c')
-rw-r--r--drivers/net/gianfar.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 3d9f958ebd2c..e6048d6ab0ea 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -2048,7 +2048,6 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
2048 u32 bufaddr; 2048 u32 bufaddr;
2049 unsigned long flags; 2049 unsigned long flags;
2050 unsigned int nr_frags, nr_txbds, length; 2050 unsigned int nr_frags, nr_txbds, length;
2051 union skb_shared_tx *shtx;
2052 2051
2053 /* 2052 /*
2054 * TOE=1 frames larger than 2500 bytes may see excess delays 2053 * TOE=1 frames larger than 2500 bytes may see excess delays
@@ -2069,10 +2068,10 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
2069 txq = netdev_get_tx_queue(dev, rq); 2068 txq = netdev_get_tx_queue(dev, rq);
2070 base = tx_queue->tx_bd_base; 2069 base = tx_queue->tx_bd_base;
2071 regs = tx_queue->grp->regs; 2070 regs = tx_queue->grp->regs;
2072 shtx = skb_tx(skb);
2073 2071
2074 /* check if time stamp should be generated */ 2072 /* check if time stamp should be generated */
2075 if (unlikely(shtx->hardware && priv->hwts_tx_en)) 2073 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP &&
2074 priv->hwts_tx_en))
2076 do_tstamp = 1; 2075 do_tstamp = 1;
2077 2076
2078 /* make space for additional header when fcb is needed */ 2077 /* make space for additional header when fcb is needed */
@@ -2174,7 +2173,7 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
2174 2173
2175 /* Setup tx hardware time stamping if requested */ 2174 /* Setup tx hardware time stamping if requested */
2176 if (unlikely(do_tstamp)) { 2175 if (unlikely(do_tstamp)) {
2177 shtx->in_progress = 1; 2176 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
2178 if (fcb == NULL) 2177 if (fcb == NULL)
2179 fcb = gfar_add_fcb(skb); 2178 fcb = gfar_add_fcb(skb);
2180 fcb->ptp = 1; 2179 fcb->ptp = 1;
@@ -2446,7 +2445,6 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
2446 int howmany = 0; 2445 int howmany = 0;
2447 u32 lstatus; 2446 u32 lstatus;
2448 size_t buflen; 2447 size_t buflen;
2449 union skb_shared_tx *shtx;
2450 2448
2451 rx_queue = priv->rx_queue[tx_queue->qindex]; 2449 rx_queue = priv->rx_queue[tx_queue->qindex];
2452 bdp = tx_queue->dirty_tx; 2450 bdp = tx_queue->dirty_tx;
@@ -2461,8 +2459,7 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
2461 * When time stamping, one additional TxBD must be freed. 2459 * When time stamping, one additional TxBD must be freed.
2462 * Also, we need to dma_unmap_single() the TxPAL. 2460 * Also, we need to dma_unmap_single() the TxPAL.
2463 */ 2461 */
2464 shtx = skb_tx(skb); 2462 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS))
2465 if (unlikely(shtx->in_progress))
2466 nr_txbds = frags + 2; 2463 nr_txbds = frags + 2;
2467 else 2464 else
2468 nr_txbds = frags + 1; 2465 nr_txbds = frags + 1;
@@ -2476,7 +2473,7 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
2476 (lstatus & BD_LENGTH_MASK)) 2473 (lstatus & BD_LENGTH_MASK))
2477 break; 2474 break;
2478 2475
2479 if (unlikely(shtx->in_progress)) { 2476 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) {
2480 next = next_txbd(bdp, base, tx_ring_size); 2477 next = next_txbd(bdp, base, tx_ring_size);
2481 buflen = next->length + GMAC_FCB_LEN; 2478 buflen = next->length + GMAC_FCB_LEN;
2482 } else 2479 } else
@@ -2485,7 +2482,7 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
2485 dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr, 2482 dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr,
2486 buflen, DMA_TO_DEVICE); 2483 buflen, DMA_TO_DEVICE);
2487 2484
2488 if (unlikely(shtx->in_progress)) { 2485 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) {
2489 struct skb_shared_hwtstamps shhwtstamps; 2486 struct skb_shared_hwtstamps shhwtstamps;
2490 u64 *ns = (u64*) (((u32)skb->data + 0x10) & ~0x7); 2487 u64 *ns = (u64*) (((u32)skb->data + 0x10) & ~0x7);
2491 memset(&shhwtstamps, 0, sizeof(shhwtstamps)); 2488 memset(&shhwtstamps, 0, sizeof(shhwtstamps));