History

Revert "net: dsa: move sja1110_process_meta_tstamp inside the tagging protocol driver"

This reverts commit 6d709cadfde68dbd12bef12fcced6222226dcb06. The above change was done to avoid calling symbols exported by the switch driver from the tagging protocol driver. With the tagger-owned storage model, we have a new option on our hands, and that is for the switch driver to provide a data consumer handler in the form of a function pointer inside the ->connect_tag_protocol() method. Having a function pointer avoids the problems of the exported symbols approach. By creating a handler for metadata frames holding TX timestamps on SJA1110, we are able to eliminate an skb queue from the tagger data, and replace it with a simple, and stateless, function pointer. This skb queue is now handled exclusively by sja1105_ptp.c, which makes the code easier to follow, as it used to be before the reverted patch.

Vladimir Oltean committed 4 years ago

Commit fcbf9791 parent c79e8485 files · +78 −67Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/dsa/sja1105.h+7−19
@@ -37,6 +37,11 @@ · 36 unmodified lines
37 37
38#define SJA1105_HWTS_RX_EN 038#define SJA1105_HWTS_RX_EN 0
39 39
40enum sja1110_meta_tstamp {
41 SJA1110_META_TSTAMP_TX = 0,
42 SJA1110_META_TSTAMP_RX = 1,
43};
44
40struct sja1105_deferred_xmit_work {45struct sja1105_deferred_xmit_work {
41 struct dsa_port *dp;46 struct dsa_port *dp;
42 struct sk_buff *skb;47 struct sk_buff *skb;
@@ -51,12 +56,10 @@ struct sja1105_tagger_data { · 8 unmodified lines
51 */56 */
52 spinlock_t meta_lock;57 spinlock_t meta_lock;
53 unsigned long state;58 unsigned long state;
54 /* Used on SJA1110 where meta frames are generated only for
55 * 2-step TX timestamps
56 */
57 struct sk_buff_head skb_txtstamp_queue;
58 struct kthread_worker *xmit_worker;59 struct kthread_worker *xmit_worker;
59 void (*xmit_work_fn)(struct kthread_work *work);60 void (*xmit_work_fn)(struct kthread_work *work);
61 void (*meta_tstamp_handler)(struct dsa_switch *ds, int port, u8 ts_id,
62 enum sja1110_meta_tstamp dir, u64 tstamp);
60};63};
61 64
62struct sja1105_skb_cb {65struct sja1105_skb_cb {
@@ -69,21 +72,6 @@ struct sja1105_skb_cb { · 6 unmodified lines
69#define SJA1105_SKB_CB(skb) \72#define SJA1105_SKB_CB(skb) \
70 ((struct sja1105_skb_cb *)((skb)->cb))73 ((struct sja1105_skb_cb *)((skb)->cb))
71 74
72/* Timestamps are in units of 8 ns clock ticks (equivalent to
73 * a fixed 125 MHz clock).
74 */
75#define SJA1105_TICK_NS 8
76
77static inline s64 ns_to_sja1105_ticks(s64 ns)
78{
79 return ns / SJA1105_TICK_NS;
80}
81
82static inline s64 sja1105_ticks_to_ns(s64 ticks)
83{
84 return ticks * SJA1105_TICK_NS;
85}
86
87static inline struct sja1105_tagger_data *75static inline struct sja1105_tagger_data *
88sja1105_tagger_data(struct dsa_switch *ds)76sja1105_tagger_data(struct dsa_switch *ds)
89{77{

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t