@@ -495,6 +495,8 @@ struct dsa_switch {
unsigned int max_num_bridges;
unsigned int num_ports;
+
+ struct completion inband_done;
};
static inline struct dsa_port *dsa_to_port(struct dsa_switch *ds, int p)
@@ -1390,6 +1392,15 @@ void dsa_tag_drivers_register(struct dsa_tag_driver *dsa_tag_driver_array[],
void dsa_tag_drivers_unregister(struct dsa_tag_driver *dsa_tag_driver_array[],
unsigned int count);
+int dsa_switch_inband_tx(struct dsa_switch *ds, struct sk_buff *skb,
+ struct completion *completion, unsigned long timeout);
+
+static inline void dsa_switch_inband_complete(struct dsa_switch *ds, struct completion *completion)
+{
+ /* Custom completion? */
+ complete(completion ?: &ds->inband_done);
+}
+
#define dsa_tag_driver_module_drivers(__dsa_tag_drivers_array, __count) \
static int __init dsa_tag_driver_module_init(void) \
{ \
@@ -324,6 +324,23 @@ int dsa_switch_resume(struct dsa_switch *ds)
EXPORT_SYMBOL_GPL(dsa_switch_resume);
#endif
+int dsa_switch_inband_tx(struct dsa_switch *ds, struct sk_buff *skb,
+ struct completion *completion, unsigned long timeout)
+{
+ struct completion *com;
+
+ /* Custom completion? */
+ com = completion ? : &ds->inband_done;
+
+ reinit_completion(com);
+
+ if (skb)
+ dev_queue_xmit(skb);
+
+ return wait_for_completion_timeout(com, msecs_to_jiffies(timeout));
+}
+EXPORT_SYMBOL_GPL(dsa_switch_inband_tx);
+
static struct packet_type dsa_pack_type __read_mostly = {
.type = cpu_to_be16(ETH_P_XDSA),
.func = dsa_switch_rcv,
@@ -874,6 +874,8 @@ static int dsa_switch_setup(struct dsa_switch *ds)
if (ds->setup)
return 0;
+ init_completion(&ds->inband_done);
+
/* Initialize ds->phys_mii_mask before registering the slave MDIO bus
* driver and before ops->setup() has run, since the switch drivers and
* the slave MDIO bus driver rely on these values for probing PHY