Skip to content

Commit f768e75

Browse files
yangbolu1991davem330
authored andcommitted
enetc: mark TX timestamp type per skb
Mark TX timestamp type per skb on skb->cb[0], instead of global variable for all skbs. This is a preparation for one step timestamp support. For one-step timestamping enablement, there will be both one-step and two-step PTP messages to transfer. And a skb queue is needed for one-step PTP messages making sure start to send current message only after the last one completed on hardware. (ENETC single-step register has to be dynamically configured per message.) So, marking TX timestamp type per skb is required. Signed-off-by: Yangbo Lu <[email protected]> Reviewed-by: Claudiu Manoil <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8043ede commit f768e75

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

drivers/net/ethernet/freescale/enetc/enetc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ static void enetc_update_tx_ring_tail(struct enetc_bdr *tx_ring)
6767
enetc_wr_reg_hot(tx_ring->tpir, tx_ring->next_to_use);
6868
}
6969

70-
static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb,
71-
int active_offloads)
70+
static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb)
7271
{
7372
struct enetc_tx_swbd *tx_swbd;
7473
skb_frag_t *frag;
@@ -101,7 +100,7 @@ static int enetc_map_tx_buffs(struct enetc_bdr *tx_ring, struct sk_buff *skb,
101100
count++;
102101

103102
do_vlan = skb_vlan_tag_present(skb);
104-
do_tstamp = (active_offloads & ENETC_F_TX_TSTAMP) &&
103+
do_tstamp = (skb->cb[0] & ENETC_F_TX_TSTAMP) &&
105104
(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP);
106105
tx_swbd->do_tstamp = do_tstamp;
107106
tx_swbd->check_wb = tx_swbd->do_tstamp;
@@ -221,6 +220,9 @@ netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev)
221220
struct enetc_bdr *tx_ring;
222221
int count;
223222

223+
/* cb[0] used for TX timestamp type */
224+
skb->cb[0] = priv->active_offloads & ENETC_F_TX_TSTAMP_MASK;
225+
224226
tx_ring = priv->tx_ring[skb->queue_mapping];
225227

226228
if (unlikely(skb_shinfo(skb)->nr_frags > ENETC_MAX_SKB_FRAGS))
@@ -234,7 +236,7 @@ netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev)
234236
}
235237

236238
enetc_lock_mdio();
237-
count = enetc_map_tx_buffs(tx_ring, skb, priv->active_offloads);
239+
count = enetc_map_tx_buffs(tx_ring, skb);
238240
enetc_unlock_mdio();
239241

240242
if (unlikely(!count))

drivers/net/ethernet/freescale/enetc/enetc.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,15 @@ struct psfp_cap {
271271
u32 max_psfp_meter;
272272
};
273273

274+
#define ENETC_F_TX_TSTAMP_MASK 0xff
274275
/* TODO: more hardware offloads */
275276
enum enetc_active_offloads {
276-
ENETC_F_RX_TSTAMP = BIT(0),
277-
ENETC_F_TX_TSTAMP = BIT(1),
278-
ENETC_F_QBV = BIT(2),
279-
ENETC_F_QCI = BIT(3),
277+
/* 8 bits reserved for TX timestamp types (hwtstamp_tx_types) */
278+
ENETC_F_TX_TSTAMP = BIT(0),
279+
280+
ENETC_F_RX_TSTAMP = BIT(8),
281+
ENETC_F_QBV = BIT(9),
282+
ENETC_F_QCI = BIT(10),
280283
};
281284

282285
/* interrupt coalescing modes */

0 commit comments

Comments
 (0)