aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/net/bfin_mac.c10
-rw-r--r--drivers/net/gianfar.c15
-rw-r--r--drivers/net/igb/igb.h2
-rw-r--r--drivers/net/igb/igb_main.c11
4 files changed, 16 insertions, 22 deletions
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 012613fde3f4..7a0e4156fade 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -803,15 +803,14 @@ static void bfin_dump_hwtamp(char *s, ktime_t *hw, ktime_t *ts, struct timecompa
803static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb) 803static void bfin_tx_hwtstamp(struct net_device *netdev, struct sk_buff *skb)
804{ 804{
805 struct bfin_mac_local *lp = netdev_priv(netdev); 805 struct bfin_mac_local *lp = netdev_priv(netdev);
806 union skb_shared_tx *shtx = skb_tx(skb);
807 806
808 if (shtx->hardware) { 807 if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) {
809 int timeout_cnt = MAX_TIMEOUT_CNT; 808 int timeout_cnt = MAX_TIMEOUT_CNT;
810 809
811 /* When doing time stamping, keep the connection to the socket 810 /* When doing time stamping, keep the connection to the socket
812 * a while longer 811 * a while longer
813 */ 812 */
814 shtx->in_progress = 1; 813 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
815 814
816 /* 815 /*
817 * The timestamping is done at the EMAC module's MII/RMII interface 816 * The timestamping is done at the EMAC module's MII/RMII interface
@@ -991,7 +990,6 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
991 struct bfin_mac_local *lp = netdev_priv(dev); 990 struct bfin_mac_local *lp = netdev_priv(dev);
992 u16 *data; 991 u16 *data;
993 u32 data_align = (unsigned long)(skb->data) & 0x3; 992 u32 data_align = (unsigned long)(skb->data) & 0x3;
994 union skb_shared_tx *shtx = skb_tx(skb);
995 993
996 current_tx_ptr->skb = skb; 994 current_tx_ptr->skb = skb;
997 995
@@ -1005,7 +1003,7 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
1005 * of this field are the length of the packet payload in bytes and the higher 1003 * of this field are the length of the packet payload in bytes and the higher
1006 * 4 bits are the timestamping enable field. 1004 * 4 bits are the timestamping enable field.
1007 */ 1005 */
1008 if (shtx->hardware) 1006 if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)
1009 *data |= 0x1000; 1007 *data |= 0x1000;
1010 1008
1011 current_tx_ptr->desc_a.start_addr = (u32)data; 1009 current_tx_ptr->desc_a.start_addr = (u32)data;
@@ -1015,7 +1013,7 @@ static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
1015 } else { 1013 } else {
1016 *((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len); 1014 *((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len);
1017 /* enable timestamping for the sent packet */ 1015 /* enable timestamping for the sent packet */
1018 if (shtx->hardware) 1016 if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)
1019 *((u16 *)(current_tx_ptr->packet)) |= 0x1000; 1017 *((u16 *)(current_tx_ptr->packet)) |= 0x1000;
1020 memcpy((u8 *)(current_tx_ptr->packet + 2), skb->data, 1018 memcpy((u8 *)(current_tx_ptr->packet + 2), skb->data,
1021 skb->len); 1019 skb->len);
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));
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index 6e63d9a7fc75..44e0ff1494e0 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -143,7 +143,7 @@ struct igb_buffer {
143 u16 next_to_watch; 143 u16 next_to_watch;
144 unsigned int bytecount; 144 unsigned int bytecount;
145 u16 gso_segs; 145 u16 gso_segs;
146 union skb_shared_tx shtx; 146 u8 tx_flags;
147 u8 mapped_as_page; 147 u8 mapped_as_page;
148 }; 148 };
149 /* RX */ 149 /* RX */
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 9b4e5895f5f9..985e37cf17b6 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -3954,7 +3954,7 @@ static inline int igb_tx_map_adv(struct igb_ring *tx_ring, struct sk_buff *skb,
3954 } 3954 }
3955 3955
3956 tx_ring->buffer_info[i].skb = skb; 3956 tx_ring->buffer_info[i].skb = skb;
3957 tx_ring->buffer_info[i].shtx = skb_shinfo(skb)->tx_flags; 3957 tx_ring->buffer_info[i].tx_flags = skb_shinfo(skb)->tx_flags;
3958 /* multiply data chunks by size of headers */ 3958 /* multiply data chunks by size of headers */
3959 tx_ring->buffer_info[i].bytecount = ((gso_segs - 1) * hlen) + skb->len; 3959 tx_ring->buffer_info[i].bytecount = ((gso_segs - 1) * hlen) + skb->len;
3960 tx_ring->buffer_info[i].gso_segs = gso_segs; 3960 tx_ring->buffer_info[i].gso_segs = gso_segs;
@@ -4088,7 +4088,6 @@ netdev_tx_t igb_xmit_frame_ring_adv(struct sk_buff *skb,
4088 u32 tx_flags = 0; 4088 u32 tx_flags = 0;
4089 u16 first; 4089 u16 first;
4090 u8 hdr_len = 0; 4090 u8 hdr_len = 0;
4091 union skb_shared_tx *shtx = skb_tx(skb);
4092 4091
4093 /* need: 1 descriptor per page, 4092 /* need: 1 descriptor per page,
4094 * + 2 desc gap to keep tail from touching head, 4093 * + 2 desc gap to keep tail from touching head,
@@ -4100,8 +4099,8 @@ netdev_tx_t igb_xmit_frame_ring_adv(struct sk_buff *skb,
4100 return NETDEV_TX_BUSY; 4099 return NETDEV_TX_BUSY;
4101 } 4100 }
4102 4101
4103 if (unlikely(shtx->hardware)) { 4102 if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
4104 shtx->in_progress = 1; 4103 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
4105 tx_flags |= IGB_TX_FLAGS_TSTAMP; 4104 tx_flags |= IGB_TX_FLAGS_TSTAMP;
4106 } 4105 }
4107 4106
@@ -5319,7 +5318,7 @@ static void igb_tx_hwtstamp(struct igb_q_vector *q_vector, struct igb_buffer *bu
5319 u64 regval; 5318 u64 regval;
5320 5319
5321 /* if skb does not support hw timestamp or TX stamp not valid exit */ 5320 /* if skb does not support hw timestamp or TX stamp not valid exit */
5322 if (likely(!buffer_info->shtx.hardware) || 5321 if (likely(!(buffer_info->tx_flags & SKBTX_HW_TSTAMP)) ||
5323 !(rd32(E1000_TSYNCTXCTL) & E1000_TSYNCTXCTL_VALID)) 5322 !(rd32(E1000_TSYNCTXCTL) & E1000_TSYNCTXCTL_VALID))
5324 return; 5323 return;
5325 5324
@@ -5500,7 +5499,7 @@ static void igb_rx_hwtstamp(struct igb_q_vector *q_vector, u32 staterr,
5500 * values must belong to this one here and therefore we don't need to 5499 * values must belong to this one here and therefore we don't need to
5501 * compare any of the additional attributes stored for it. 5500 * compare any of the additional attributes stored for it.
5502 * 5501 *
5503 * If nothing went wrong, then it should have a skb_shared_tx that we 5502 * If nothing went wrong, then it should have a shared tx_flags that we
5504 * can turn into a skb_shared_hwtstamps. 5503 * can turn into a skb_shared_hwtstamps.
5505 */ 5504 */
5506 if (staterr & E1000_RXDADV_STAT_TSIP) { 5505 if (staterr & E1000_RXDADV_STAT_TSIP) {