iwlwifi: virtualize op_mode's free skb

This handler allows the transport layer to free an skb from the
op_mode. This can happen when the driver is stopped while Tx
packets are pending in the transport layer.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
diff --git a/drivers/net/wireless/iwlwifi/iwl-op-mode.h b/drivers/net/wireless/iwlwifi/iwl-op-mode.h
index c85c8dc..59dd3074 100644
--- a/drivers/net/wireless/iwlwifi/iwl-op-mode.h
+++ b/drivers/net/wireless/iwlwifi/iwl-op-mode.h
@@ -65,6 +65,7 @@
 
 struct iwl_op_mode;
 struct iwl_trans;
+struct sk_buff;
 
 /**
  * struct iwl_op_mode_ops - op_mode specific operations
@@ -75,10 +76,15 @@
  *	May sleep
  * @stop: stop the op_mode
  *	May sleep
+ * @free_skb: allows the transport layer to free skbs that haven't been
+ *	reclaimed by the op_mode. This can happen when the driver is freed and
+ *	there are Tx packets pending in the transport layer.
+ *	Must be atomic
  */
 struct iwl_op_mode_ops {
 	struct iwl_op_mode *(*start)(struct iwl_trans *trans);
 	void (*stop)(struct iwl_op_mode *op_mode);
+	void (*free_skb)(struct iwl_op_mode *op_mode, struct sk_buff *skb);
 };
 
 /**
@@ -100,6 +106,12 @@
 	op_mode->ops->stop(op_mode);
 }
 
+static inline void iwl_op_mode_free_skb(struct iwl_op_mode *op_mode,
+					struct sk_buff *skb)
+{
+	op_mode->ops->free_skb(op_mode, skb);
+}
+
 /*****************************************************
 * Op mode layers implementations
 ******************************************************/