[PATCH 01/17] rtl8192e: Create an ops struct similar to mac80211's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Mike McCormack <mikem@xxxxxxxxxx>
---
 drivers/staging/rtl8192e/ieee80211/ieee80211.h     |   18 +++++++-----------
 .../staging/rtl8192e/ieee80211/ieee80211_module.c  |    4 ++--
 .../staging/rtl8192e/ieee80211/ieee80211_softmac.c |    4 ++--
 drivers/staging/rtl8192e/r8192E_core.c             |    9 ++++++---
 drivers/staging/rtl8192e/r819xE_cmdpkt.c           |    2 +-
 drivers/staging/rtl8192e/r819xE_firmware.c         |    2 +-
 6 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211.h b/drivers/staging/rtl8192e/ieee80211/ieee80211.h
index 3ca3881..ec45854 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211.h
@@ -1793,8 +1793,14 @@ typedef enum _HW_VARIABLES{
 
 #define RT_CHECK_FOR_HANG_PERIOD 2
 
+/* partial clone of mac80211's ieee80211_ops struct */
+struct ieee80211_ops {
+	int (*tx)(struct ieee80211_device *hw, struct sk_buff *skb);
+};
+
 struct ieee80211_device {
 	struct net_device *dev;
+	const struct ieee80211_ops *ops;
         struct ieee80211_security sec;
 
 	bool	need_sw_enc;
@@ -2116,16 +2122,6 @@ struct ieee80211_device {
                                   struct ieee80211_network * network, u16 type);
         int (*is_qos_active) (struct ieee80211_device *ieee, struct sk_buff *skb);
 
-	/* Softmac-generated frames (mamagement) are TXed via this
-	 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
-	 * not set. As some cards may have different HW queues that
-	 * one might want to use for data and management frames
-	 * the option to have two callbacks might be useful.
-	 * This fucntion can't sleep.
-	 */
-	int (*softmac_hard_start_xmit)(struct sk_buff *skb,
-			       struct ieee80211_device *ieee80211);
-
 	/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
 	 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
 	 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
@@ -2377,7 +2373,7 @@ static inline int ieee80211_is_cck_rate(u8 rate)
 
 /* ieee80211.c */
 void free_ieee80211(struct net_device *dev);
-struct net_device *alloc_ieee80211(int sizeof_priv);
+struct net_device *alloc_ieee80211(int sizeof_priv, const struct ieee80211_ops *ops);
 
 int ieee80211_set_encryption(struct ieee80211_device *ieee);
 
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
index 663b0b8..a3acd6e 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
@@ -95,7 +95,7 @@ static inline void ieee80211_networks_initialize(struct ieee80211_device *ieee)
 }
 
 
-struct net_device *alloc_ieee80211(int sizeof_priv)
+struct net_device *alloc_ieee80211(int sizeof_priv, const struct ieee80211_ops *ops)
 {
 	struct ieee80211_device *ieee;
 	struct net_device *dev;
@@ -112,6 +112,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
 	ieee = netdev_priv(dev);
 
 	memset(ieee, 0, sizeof(struct ieee80211_device) + sizeof_priv);
+	ieee->ops = ops;
 	ieee->dev = dev;
 
 	err = ieee80211_networks_allocate(ieee);
@@ -122,7 +123,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
 	}
 	ieee80211_networks_initialize(ieee);
 
-
 	/* Default fragmentation threshold is maximum payload size */
 	ieee->fts = DEFAULT_FTS;
 	ieee->scan_age = DEFAULT_MAX_SCAN_AGE;
diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
index f6922d4..49c006f 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
@@ -268,7 +268,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee
 			 * */
 			skb_queue_tail(&ieee->skb_waitQ[tcb_desc->queue_index], skb);
 		} else {
-			ieee->softmac_hard_start_xmit(skb, ieee);
+			ieee->ops->tx(ieee, skb);
 		}
 		spin_unlock(&ieee->mgmt_tx_lock);
 	}
@@ -308,7 +308,7 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *i
 		else
 			ieee->seq_ctrl[0]++;
 
-		ieee->softmac_hard_start_xmit(skb, ieee);
+		ieee->ops->tx(ieee, skb);
 
 	}
 }
diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c
index 58d800f..3d0c93c 100644
--- a/drivers/staging/rtl8192e/r8192E_core.c
+++ b/drivers/staging/rtl8192e/r8192E_core.c
@@ -848,7 +848,7 @@ static void rtl8192_hard_data_xmit(struct sk_buff *skb,
  * If the ring is full packet are dropped (for data frame the queue
  * is stopped before this can happen).
  */
-static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct ieee80211_device *ieee80211)
+static int rtl8192_hard_start_xmit(struct ieee80211_device *ieee80211, struct sk_buff *skb)
 {
 	struct r8192_priv *priv = ieee80211_priv(ieee80211->dev);
 	int ret;
@@ -1918,7 +1918,6 @@ static void rtl8192_init_priv_variable(struct r8192_priv *priv)
 	priv->ieee80211->host_decrypt = 1;
 	priv->ieee80211->start_send_beacons = rtl8192_start_beacon;
 	priv->ieee80211->stop_send_beacons = rtl8192_stop_beacon;
-	priv->ieee80211->softmac_hard_start_xmit = rtl8192_hard_start_xmit;
 	priv->ieee80211->set_chan = rtl8192_set_chan;
 	priv->ieee80211->link_change = rtl8192_link_change;
 	priv->ieee80211->softmac_data_hard_start_xmit = rtl8192_hard_data_xmit;
@@ -4524,6 +4523,10 @@ static const struct net_device_ops rtl8192_netdev_ops = {
 	.ndo_start_xmit = 		ieee80211_rtl_xmit,
 };
 
+static const struct ieee80211_ops r8192e_ops = {
+	.tx =				rtl8192_hard_start_xmit,
+};
+
 static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
 			 const struct pci_device_id *id)
 {
@@ -4544,7 +4547,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
 	//pci_set_wmi(pdev);
 	pci_set_dma_mask(pdev, 0xffffff00ULL);
 	pci_set_consistent_dma_mask(pdev,0xffffff00ULL);
-	dev = alloc_ieee80211(sizeof(struct r8192_priv));
+	dev = alloc_ieee80211(sizeof(struct r8192_priv), &r8192e_ops);
 	if (!dev) {
 		ret = -ENOMEM;
 		goto fail_free;
diff --git a/drivers/staging/rtl8192e/r819xE_cmdpkt.c b/drivers/staging/rtl8192e/r819xE_cmdpkt.c
index 756e066..a64a4d8 100644
--- a/drivers/staging/rtl8192e/r819xE_cmdpkt.c
+++ b/drivers/staging/rtl8192e/r819xE_cmdpkt.c
@@ -101,7 +101,7 @@ RT_STATUS cmpk_message_handle_tx(
                 *seg_ptr++ = ((i+3)<frag_length)?code_virtual_address[i+0]:0;
             }
             skb_put(skb, i);
-            priv->ieee80211->softmac_hard_start_xmit(skb, priv->ieee80211);
+            priv->ieee80211->ops->tx(priv->ieee80211, skb);
 
             code_virtual_address += frag_length;
             frag_offset += frag_length;
diff --git a/drivers/staging/rtl8192e/r819xE_firmware.c b/drivers/staging/rtl8192e/r819xE_firmware.c
index d9e8b5a..71b0a24 100644
--- a/drivers/staging/rtl8192e/r819xE_firmware.c
+++ b/drivers/staging/rtl8192e/r819xE_firmware.c
@@ -93,7 +93,7 @@ static bool fw_download_code(struct r8192_priv *priv, u8 *code_virtual_address,
 		}
 		tcb_desc->txbuf_size = (u16)i;
 		skb_put(skb, i);
-		priv->ieee80211->softmac_hard_start_xmit(skb, priv->ieee80211);
+		priv->ieee80211->ops->tx(priv->ieee80211, skb);
 
 		code_virtual_address += frag_length;
 		frag_offset += frag_length;
-- 
1.7.0.4


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux