aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/ti/cpsw.c3
-rw-r--r--drivers/net/ethernet/ti/cpts.h16
2 files changed, 18 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 422994ea0b49..1850e348f555 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1598,6 +1598,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
1598{ 1598{
1599 struct cpsw_priv *priv = netdev_priv(ndev); 1599 struct cpsw_priv *priv = netdev_priv(ndev);
1600 struct cpsw_common *cpsw = priv->cpsw; 1600 struct cpsw_common *cpsw = priv->cpsw;
1601 struct cpts *cpts = cpsw->cpts;
1601 struct netdev_queue *txq; 1602 struct netdev_queue *txq;
1602 struct cpdma_chan *txch; 1603 struct cpdma_chan *txch;
1603 int ret, q_idx; 1604 int ret, q_idx;
@@ -1609,7 +1610,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
1609 } 1610 }
1610 1611
1611 if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP && 1612 if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP &&
1612 cpts_is_tx_enabled(cpsw->cpts)) 1613 cpts_is_tx_enabled(cpts) && cpts_can_timestamp(cpts, skb))
1613 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; 1614 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
1614 1615
1615 q_idx = skb_get_queue_mapping(skb); 1616 q_idx = skb_get_queue_mapping(skb);
diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h
index c96eca2b1b46..01ea82ba9cdc 100644
--- a/drivers/net/ethernet/ti/cpts.h
+++ b/drivers/net/ethernet/ti/cpts.h
@@ -30,6 +30,7 @@
30#include <linux/of.h> 30#include <linux/of.h>
31#include <linux/ptp_clock_kernel.h> 31#include <linux/ptp_clock_kernel.h>
32#include <linux/skbuff.h> 32#include <linux/skbuff.h>
33#include <linux/ptp_classify.h>
33#include <linux/timecounter.h> 34#include <linux/timecounter.h>
34 35
35struct cpsw_cpts { 36struct cpsw_cpts {
@@ -155,6 +156,16 @@ static inline bool cpts_is_tx_enabled(struct cpts *cpts)
155 return !!cpts->tx_enable; 156 return !!cpts->tx_enable;
156} 157}
157 158
159static inline bool cpts_can_timestamp(struct cpts *cpts, struct sk_buff *skb)
160{
161 unsigned int class = ptp_classify_raw(skb);
162
163 if (class == PTP_CLASS_NONE)
164 return false;
165
166 return true;
167}
168
158#else 169#else
159struct cpts; 170struct cpts;
160 171
@@ -203,6 +214,11 @@ static inline bool cpts_is_tx_enabled(struct cpts *cpts)
203{ 214{
204 return false; 215 return false;
205} 216}
217
218static inline bool cpts_can_timestamp(struct cpts *cpts, struct sk_buff *skb)
219{
220 return false;
221}
206#endif 222#endif
207 223
208 224