diff options
Diffstat (limited to 'include/linux/dsa')
| -rw-r--r-- | include/linux/dsa/8021q.h | 9 | ||||
| -rw-r--r-- | include/linux/dsa/loop.h | 1 | ||||
| -rw-r--r-- | include/linux/dsa/ocelot.h | 12 | ||||
| -rw-r--r-- | include/linux/dsa/sja1105.h | 62 | 
4 files changed, 38 insertions, 46 deletions
| diff --git a/include/linux/dsa/8021q.h b/include/linux/dsa/8021q.h index 254b165f2b44..939a1beaddf7 100644 --- a/include/linux/dsa/8021q.h +++ b/include/linux/dsa/8021q.h @@ -7,6 +7,7 @@  #include <linux/refcount.h>  #include <linux/types.h> +#include <net/dsa.h>  struct dsa_switch;  struct dsa_port; @@ -37,14 +38,12 @@ struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,  void dsa_8021q_rcv(struct sk_buff *skb, int *source_port, int *switch_id);  int dsa_tag_8021q_bridge_tx_fwd_offload(struct dsa_switch *ds, int port, -					struct net_device *br, -					int bridge_num); +					struct dsa_bridge bridge);  void dsa_tag_8021q_bridge_tx_fwd_unoffload(struct dsa_switch *ds, int port, -					   struct net_device *br, -					   int bridge_num); +					   struct dsa_bridge bridge); -u16 dsa_8021q_bridge_tx_fwd_offload_vid(int bridge_num); +u16 dsa_8021q_bridge_tx_fwd_offload_vid(unsigned int bridge_num);  u16 dsa_tag_8021q_tx_vid(const struct dsa_port *dp); diff --git a/include/linux/dsa/loop.h b/include/linux/dsa/loop.h index 5a3470bcc8a7..b8fef35591aa 100644 --- a/include/linux/dsa/loop.h +++ b/include/linux/dsa/loop.h @@ -2,6 +2,7 @@  #ifndef DSA_LOOP_H  #define DSA_LOOP_H +#include <linux/if_vlan.h>  #include <linux/types.h>  #include <linux/ethtool.h>  #include <net/dsa.h> diff --git a/include/linux/dsa/ocelot.h b/include/linux/dsa/ocelot.h index 7ee708ad7df2..dca2969015d8 100644 --- a/include/linux/dsa/ocelot.h +++ b/include/linux/dsa/ocelot.h @@ -8,6 +8,7 @@  #include <linux/kthread.h>  #include <linux/packing.h>  #include <linux/skbuff.h> +#include <net/dsa.h>  struct ocelot_skb_cb {  	struct sk_buff *clone; @@ -168,11 +169,18 @@ struct felix_deferred_xmit_work {  	struct kthread_work work;  }; -struct felix_port { +struct ocelot_8021q_tagger_data {  	void (*xmit_work_fn)(struct kthread_work *work); -	struct kthread_worker *xmit_worker;  }; +static inline struct ocelot_8021q_tagger_data * +ocelot_8021q_tagger_data(struct dsa_switch *ds) +{ +	BUG_ON(ds->dst->tag_ops->proto != DSA_TAG_PROTO_OCELOT_8021Q); + +	return ds->tagger_data; +} +  static inline void ocelot_xfh_get_rew_val(void *extraction, u64 *rew_val)  {  	packing(extraction, rew_val, 116, 85, OCELOT_TAG_LEN, UNPACK, 0); diff --git a/include/linux/dsa/sja1105.h b/include/linux/dsa/sja1105.h index e6c78be40bde..159e43171ccc 100644 --- a/include/linux/dsa/sja1105.h +++ b/include/linux/dsa/sja1105.h @@ -35,23 +35,26 @@  #define SJA1105_META_SMAC			0x222222222222ull  #define SJA1105_META_DMAC			0x0180C200000Eull -#define SJA1105_HWTS_RX_EN			0 +enum sja1110_meta_tstamp { +	SJA1110_META_TSTAMP_TX = 0, +	SJA1110_META_TSTAMP_RX = 1, +}; -/* Global tagger data: each struct sja1105_port has a reference to - * the structure defined in struct sja1105_private. - */ +struct sja1105_deferred_xmit_work { +	struct dsa_port *dp; +	struct sk_buff *skb; +	struct kthread_work work; +}; + +/* Global tagger data */  struct sja1105_tagger_data { -	struct sk_buff *stampable_skb; -	/* Protects concurrent access to the meta state machine -	 * from taggers running on multiple ports on SMP systems -	 */ -	spinlock_t meta_lock; -	unsigned long state; -	u8 ts_id; -	/* Used on SJA1110 where meta frames are generated only for -	 * 2-step TX timestamps -	 */ -	struct sk_buff_head skb_txtstamp_queue; +	/* Tagger to switch */ +	void (*xmit_work_fn)(struct kthread_work *work); +	void (*meta_tstamp_handler)(struct dsa_switch *ds, int port, u8 ts_id, +				    enum sja1110_meta_tstamp dir, u64 tstamp); +	/* Switch to tagger */ +	bool (*rxtstamp_get_state)(struct dsa_switch *ds); +	void (*rxtstamp_set_state)(struct dsa_switch *ds, bool on);  };  struct sja1105_skb_cb { @@ -64,32 +67,13 @@ struct sja1105_skb_cb {  #define SJA1105_SKB_CB(skb) \  	((struct sja1105_skb_cb *)((skb)->cb)) -struct sja1105_port { -	struct kthread_worker *xmit_worker; -	struct kthread_work xmit_work; -	struct sk_buff_head xmit_queue; -	struct sja1105_tagger_data *data; -	bool hwts_tx_en; -}; - -/* Timestamps are in units of 8 ns clock ticks (equivalent to - * a fixed 125 MHz clock). - */ -#define SJA1105_TICK_NS			8 - -static inline s64 ns_to_sja1105_ticks(s64 ns) +static inline struct sja1105_tagger_data * +sja1105_tagger_data(struct dsa_switch *ds)  { -	return ns / SJA1105_TICK_NS; -} +	BUG_ON(ds->dst->tag_ops->proto != DSA_TAG_PROTO_SJA1105 && +	       ds->dst->tag_ops->proto != DSA_TAG_PROTO_SJA1110); -static inline s64 sja1105_ticks_to_ns(s64 ticks) -{ -	return ticks * SJA1105_TICK_NS; -} - -static inline bool dsa_port_is_sja1105(struct dsa_port *dp) -{ -	return true; +	return ds->tagger_data;  }  #endif /* _NET_DSA_SJA1105_H */ |