staging: rtl8192e: Convert array rx_ring[] to rx_ring
cover staging: rtl8192e: Convert array rx_ring[] to rx_ring
Remove some functions that always return false or zero.
Remove a loop that is always executed one time and convert arrays to variables. Remove some unused constants.
Tested with rtl8192e (WLL6130-D99) in Mode n (12.5 MB/s) Transferred this patch over wlan connection of rtl8192e.
Philipp Hortmann (10):
staging: rtl8192e: Remove HTIOTActIsDisableMCS14()
staging: rtl8192e: Remove HTIOTActIsDisableMCS15()
staging: rtl8192e: Remove HTIOTActIsDisableMCSTwoSpatialStream()
staging: rtl8192e: Remove HTIOTActIsDisableEDCATurbo()
staging: rtl8192e: Remove loops with constant MAX_RX_QUEUE
staging: rtl8192e: Convert array rx_ring[] to variable rx_ring
staging: rtl8192e: Convert array rx_buf[][] to array rx_buf[]
staging: rtl8192e: Convert array rx_ring_dma[] to variable rx_ring_dma
staging: rtl8192e: Convert array rx_idx[] to variable rx_idx
staging: rtl8192e: Remove unused constants starting with MAX_RX_QUEUE
.../staging/rtl8192e/rtl8192e/r8190P_def.h | 2 - .../staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- .../staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 62 +-------- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 131 ++++++++---------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 10 +- drivers/staging/rtl8192e/rtl819x_HTProc.c | 37 ----- drivers/staging/rtl8192e/rtl819x_Qos.h | 1 - drivers/staging/rtl8192e/rtl819x_TS.h | 1 - drivers/staging/rtl8192e/rtllib.h | 1 - 9 files changed, 67 insertions(+), 180 deletions(-)
Signature · 1 line
2.42.0
PATCH 1/10 staging: rtl8192e: Remove HTIOTActIsDisableMCS14()
Remove HTIOTActIsDisableMCS14() as it always returns zero which leads to one evaluation that is always false. Remove dead code.
--- drivers/staging/rtl8192e/rtl819x_HTProc.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +0 -9
@@ -207,11 +207,6 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)netdev_dbg (ieee->dev,"IOTPEER: %x\n" , ht_info->IOTPeer); } -static u8 HTIOTActIsDisableMCS14 (struct rtllib_device *ieee,u8 *PeerMacAddr) -{ -return 0 ; -} -static bool HTIOTActIsDisableMCS15 (struct rtllib_device *ieee) {return false;
@@ -696,10 +691,6 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,HTIOTPeerDetermine (ieee); ht_info->iot_action =0 ; - bIOTAction =HTIOTActIsDisableMCS14 (ieee, pNetwork->bssid); -if (bIOTAction) - ht_info->iot_action |=HT_IOT_ACT_DISABLE_MCS14 ; - bIOTAction =HTIOTActIsDisableMCS15 (ieee);if (bIOTAction) ht_info->iot_action |=HT_IOT_ACT_DISABLE_MCS15 ;
Signature · 1 line
2.42.0
PATCH 2/10 staging: rtl8192e: Remove HTIOTActIsDisableMCS15()
In reply to Philipp HortmannRemove HTIOTActIsDisableMCS15() as it always returns false which leads to one evaluation that is always false. Remove dead code.
--- drivers/staging/rtl8192e/rtl819x_HTProc.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +0 -9
@@ -207,11 +207,6 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)netdev_dbg (ieee->dev,"IOTPEER: %x\n" , ht_info->IOTPeer); } -static bool HTIOTActIsDisableMCS15 (struct rtllib_device *ieee) -{ -return false; -} -static bool HTIOTActIsDisableMCSTwoSpatialStream (struct rtllib_device *ieee) {return false;
@@ -691,10 +686,6 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,HTIOTPeerDetermine (ieee); ht_info->iot_action =0 ; - bIOTAction =HTIOTActIsDisableMCS15 (ieee); -if (bIOTAction) - ht_info->iot_action |=HT_IOT_ACT_DISABLE_MCS15 ; - bIOTAction =HTIOTActIsDisableMCSTwoSpatialStream (ieee);if (bIOTAction) ht_info->iot_action |=HT_IOT_ACT_DISABLE_ALL_2SS ;
Signature · 1 line
2.42.0
PATCH 3/10 staging: rtl8192e: Remove HTIOTActIsDisableMCSTwoSpatialStream()
In reply to Philipp HortmannRemove HTIOTActIsDisableMCSTwoSpatialStream() as it always returns false which leads to one evaluation that is always false. Remove dead code.
--- drivers/staging/rtl8192e/rtl819x_HTProc.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +0 -9
@@ -207,11 +207,6 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)netdev_dbg (ieee->dev,"IOTPEER: %x\n" , ht_info->IOTPeer); } -static bool HTIOTActIsDisableMCSTwoSpatialStream (struct rtllib_device *ieee) -{ -return false; -} -static u8 HTIOTActIsDisableEDCATurbo (struct rtllib_device *ieee,u8 *PeerMacAddr) {
@@ -686,10 +681,6 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,HTIOTPeerDetermine (ieee); ht_info->iot_action =0 ; - bIOTAction =HTIOTActIsDisableMCSTwoSpatialStream (ieee); -if (bIOTAction) - ht_info->iot_action |=HT_IOT_ACT_DISABLE_ALL_2SS ; - bIOTAction =HTIOTActIsDisableEDCATurbo (ieee, pNetwork->bssid);if (bIOTAction) ht_info->iot_action |=HT_IOT_ACT_DISABLE_EDCA_TURBO ;
Signature · 1 line
2.42.0
PATCH 4/10 staging: rtl8192e: Remove HTIOTActIsDisableEDCATurbo()
In reply to Philipp HortmannRemove HTIOTActIsDisableEDCATurbo() as it always returns false which leads to one evaluation that is always false. Remove dead code.
--- drivers/staging/rtl8192e/rtl819x_HTProc.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/staging/rtl8192e/rtl819x_HTProc.c +0 -10
@@ -207,12 +207,6 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)netdev_dbg (ieee->dev,"IOTPEER: %x\n" , ht_info->IOTPeer); } -static u8 HTIOTActIsDisableEDCATurbo (struct rtllib_device *ieee, -u8 *PeerMacAddr) -{ -return false; -} -static u8 HTIOTActIsMgntUseCCK6M (struct rtllib_device *ieee,struct rtllib_network *network) {
@@ -681,10 +675,6 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,HTIOTPeerDetermine (ieee); ht_info->iot_action =0 ; - bIOTAction =HTIOTActIsDisableEDCATurbo (ieee, pNetwork->bssid); -if (bIOTAction) - ht_info->iot_action |=HT_IOT_ACT_DISABLE_EDCA_TURBO ; - bIOTAction =HTIOTActIsMgntUseCCK6M (ieee, pNetwork);if (bIOTAction) ht_info->iot_action |=HT_IOT_ACT_MGNT_USE_CCK_6M ;
Signature · 1 line
2.42.0
PATCH 5/10 staging: rtl8192e: Remove loops with constant MAX_RX_QUEUE
In reply to Philipp HortmannMAX_RX_QUEUE is set to 1. All loops with MAX_RX_QUEUE run only one cycle. Remove loops.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 120 +++++++++---------- 1 file changed, 58 insertions(+), 62 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +58 -62
@@ -1141,28 +1141,26 @@ void rtl92e_tx_enable(struct net_device *dev)static void _rtl92e_free_rx_ring (struct net_device *dev) {struct r8192_priv *priv =rtllib_priv (dev); -int i, rx_queue_idx; - -for (rx_queue_idx =0 ; rx_queue_idx <MAX_RX_QUEUE ; - rx_queue_idx++) { -for (i =0 ; i < priv->rxringcount; i++) { -struct sk_buff *skb = priv->rx_buf[rx_queue_idx][i]; +int i; +int rx_queue_idx =0 ; -if (!skb) -continue ; +for (i =0 ; i < priv->rxringcount; i++) { +struct sk_buff *skb = priv->rx_buf[rx_queue_idx][i]; -dma_unmap_single (&priv->pdev->dev, - *((dma_addr_t *)skb->cb), - priv->rxbuffersize,DMA_FROM_DEVICE ); -kfree_skb (skb); - } +if (!skb) +continue ; -dma_free_coherent (&priv->pdev->dev, -sizeof (*priv->rx_ring[rx_queue_idx]) * priv->rxringcount, - priv->rx_ring[rx_queue_idx], - priv->rx_ring_dma[rx_queue_idx]); - priv->rx_ring[rx_queue_idx] =NULL ; +dma_unmap_single (&priv->pdev->dev, + *((dma_addr_t *)skb->cb), + priv->rxbuffersize,DMA_FROM_DEVICE ); +kfree_skb (skb); } + +dma_free_coherent (&priv->pdev->dev, +sizeof (*priv->rx_ring[rx_queue_idx]) * priv->rxringcount, + priv->rx_ring[rx_queue_idx], + priv->rx_ring_dma[rx_queue_idx]); + priv->rx_ring[rx_queue_idx] =NULL ; }static void _rtl92e_free_tx_ring (struct net_device *dev,unsigned int prio)
@@ -1353,47 +1351,46 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev) {struct r8192_priv *priv =rtllib_priv (dev);struct rx_desc *entry =NULL ; -int i, rx_queue_idx; - -for (rx_queue_idx =0 ; rx_queue_idx <MAX_RX_QUEUE ; rx_queue_idx++) { - priv->rx_ring[rx_queue_idx] =dma_alloc_coherent (&priv->pdev->dev, -sizeof (*priv->rx_ring[rx_queue_idx]) * priv->rxringcount, - &priv->rx_ring_dma[rx_queue_idx], -GFP_ATOMIC ); -if (!priv->rx_ring[rx_queue_idx] || - (unsigned long )priv->rx_ring[rx_queue_idx] &0xFF ) { -netdev_warn (dev,"Cannot allocate RX ring\n" ); -return -ENOMEM ; - } - - priv->rx_idx[rx_queue_idx] =0 ; +int i; +int rx_queue_idx =0 ; + + priv->rx_ring[rx_queue_idx] =dma_alloc_coherent (&priv->pdev->dev, +sizeof (*priv->rx_ring[rx_queue_idx]) * priv->rxringcount, + &priv->rx_ring_dma[rx_queue_idx], +GFP_ATOMIC ); +if (!priv->rx_ring[rx_queue_idx] || + (unsigned long )priv->rx_ring[rx_queue_idx] &0xFF ) { +netdev_warn (dev,"Cannot allocate RX ring\n" ); +return -ENOMEM ; + } -for (i =0 ; i < priv->rxringcount; i++) { -struct sk_buff *skb =dev_alloc_skb (priv->rxbuffersize); -dma_addr_t *mapping; + priv->rx_idx[rx_queue_idx] =0 ; - entry = &priv->rx_ring[rx_queue_idx][i]; -if (!skb) -return 0 ; - skb->dev = dev; - priv->rx_buf[rx_queue_idx][i] = skb; - mapping = (dma_addr_t *)skb->cb; - *mapping =dma_map_single (&priv->pdev->dev, -skb_tail_pointer (skb), - priv->rxbuffersize,DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->pdev->dev, *mapping)) { -dev_kfree_skb_any (skb); -return -1 ; - } - entry->BufferAddress = *mapping; +for (i =0 ; i < priv->rxringcount; i++) { +struct sk_buff *skb =dev_alloc_skb (priv->rxbuffersize); +dma_addr_t *mapping; - entry->Length = priv->rxbuffersize; - entry->OWN =1 ; + entry = &priv->rx_ring[rx_queue_idx][i]; +if (!skb) +return 0 ; + skb->dev = dev; + priv->rx_buf[rx_queue_idx][i] = skb; + mapping = (dma_addr_t *)skb->cb; + *mapping =dma_map_single (&priv->pdev->dev, +skb_tail_pointer (skb), + priv->rxbuffersize,DMA_FROM_DEVICE ); +if (dma_mapping_error (&priv->pdev->dev, *mapping)) { +dev_kfree_skb_any (skb); +return -1 ; } + entry->BufferAddress = *mapping; -if (entry) - entry->EOR =1 ; + entry->Length = priv->rxbuffersize; + entry->OWN =1 ; } + +if (entry) + entry->EOR =1 ;return 0 ; }
@@ -1455,19 +1452,18 @@ static short _rtl92e_pci_initdescring(struct net_device *dev)void rtl92e_reset_desc_ring (struct net_device *dev) {struct r8192_priv *priv =rtllib_priv (dev); -int i, rx_queue_idx; +int i; +int rx_queue_idx =0 ;unsigned long flags =0 ; -for (rx_queue_idx =0 ; rx_queue_idx <MAX_RX_QUEUE ; rx_queue_idx++) { -if (priv->rx_ring[rx_queue_idx]) { -struct rx_desc *entry =NULL ; +if (priv->rx_ring[rx_queue_idx]) { +struct rx_desc *entry =NULL ; -for (i =0 ; i < priv->rxringcount; i++) { - entry = &priv->rx_ring[rx_queue_idx][i]; - entry->OWN =1 ; - } - priv->rx_idx[rx_queue_idx] =0 ; +for (i =0 ; i < priv->rxringcount; i++) { + entry = &priv->rx_ring[rx_queue_idx][i]; + entry->OWN =1 ; } + priv->rx_idx[rx_queue_idx] =0 ; }spin_lock_irqsave (&priv->irq_th_lock, flags);
Signature · 1 line
2.42.0
PATCH 6/10 staging: rtl8192e: Convert array rx_ring[] to variable rx_ring
In reply to Philipp HortmannConvert array rx_ring[] to variable rx_ring as index is always 0. This increases readability.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 25 ++++++++++---------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +12 -13
@@ -1157,10 +1157,10 @@ static void _rtl92e_free_rx_ring(struct net_device *dev) }dma_free_coherent (&priv->pdev->dev, -sizeof (*priv->rx_ring[rx_queue_idx]) * priv->rxringcount, - priv->rx_ring[rx_queue_idx], +sizeof (*priv->rx_ring) * priv->rxringcount, + priv->rx_ring, priv->rx_ring_dma[rx_queue_idx]); - priv->rx_ring[rx_queue_idx] =NULL ; + priv->rx_ring =NULL ; }static void _rtl92e_free_tx_ring (struct net_device *dev,unsigned int prio)
@@ -1354,12 +1354,11 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)int i;int rx_queue_idx =0 ; - priv->rx_ring[rx_queue_idx] =dma_alloc_coherent (&priv->pdev->dev, -sizeof (*priv->rx_ring[rx_queue_idx]) * priv->rxringcount, - &priv->rx_ring_dma[rx_queue_idx], -GFP_ATOMIC ); -if (!priv->rx_ring[rx_queue_idx] || - (unsigned long )priv->rx_ring[rx_queue_idx] &0xFF ) { + priv->rx_ring =dma_alloc_coherent (&priv->pdev->dev, +sizeof (*priv->rx_ring) * priv->rxringcount, + &priv->rx_ring_dma[rx_queue_idx], +GFP_ATOMIC ); +if (!priv->rx_ring || (unsigned long )priv->rx_ring &0xFF ) {netdev_warn (dev,"Cannot allocate RX ring\n" );return -ENOMEM ; }
@@ -1370,7 +1369,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)struct sk_buff *skb =dev_alloc_skb (priv->rxbuffersize);dma_addr_t *mapping; - entry = &priv->rx_ring[rx_queue_idx][i]; + entry = &priv->rx_ring[i];if (!skb)return 0 ; skb->dev = dev;
@@ -1456,11 +1455,11 @@ void rtl92e_reset_desc_ring(struct net_device *dev)int rx_queue_idx =0 ;unsigned long flags =0 ; -if (priv->rx_ring[rx_queue_idx]) { +if (priv->rx_ring) {struct rx_desc *entry =NULL ;for (i =0 ; i < priv->rxringcount; i++) { - entry = &priv->rx_ring[rx_queue_idx][i]; + entry = &priv->rx_ring[i]; entry->OWN =1 ; } priv->rx_idx[rx_queue_idx] =0 ;
@@ -1574,7 +1573,7 @@ static void _rtl92e_rx_normal(struct net_device *dev) stats.nic_type =NIC_8192E ;while (count--) { -struct rx_desc *pdesc = &priv->rx_ring[rx_queue_idx] +struct rx_desc *pdesc = &priv->rx_ring [priv->rx_idx[rx_queue_idx]];struct sk_buff *skb = priv->rx_buf[rx_queue_idx] [priv->rx_idx[rx_queue_idx]];
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +1 -1
@@ -232,7 +232,7 @@ struct r8192_priv {u8 (*rf_set_chan)(struct net_device *dev,u8 ch); -struct rx_desc *rx_ring[MAX_RX_QUEUE ]; +struct rx_desc *rx_ring;struct sk_buff *rx_buf[MAX_RX_QUEUE ][MAX_RX_COUNT ];dma_addr_t rx_ring_dma[MAX_RX_QUEUE ];unsigned int rx_idx[MAX_RX_QUEUE ];
Signature · 1 line
2.42.0
PATCH 7/10 staging: rtl8192e: Convert array rx_buf[][] to array rx_buf[]
In reply to Philipp HortmannConvert array rx_buf[][] to array rx_buf[] as index is always 0. This increases readability.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 8 ++++---- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +4 -4
@@ -1145,7 +1145,7 @@ static void _rtl92e_free_rx_ring(struct net_device *dev)int rx_queue_idx =0 ;for (i =0 ; i < priv->rxringcount; i++) { -struct sk_buff *skb = priv->rx_buf[rx_queue_idx][i]; +struct sk_buff *skb = priv->rx_buf[i];if (!skb)continue ;
@@ -1373,7 +1373,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)if (!skb)return 0 ; skb->dev = dev; - priv->rx_buf[rx_queue_idx][i] = skb; + priv->rx_buf[i] = skb; mapping = (dma_addr_t *)skb->cb; *mapping = dma_map_single(&priv->pdev->dev, skb_tail_pointer(skb),
@@ -1575,7 +1575,7 @@ static void _rtl92e_rx_normal(struct net_device *dev)while (count--) {struct rx_desc *pdesc = &priv->rx_ring [priv->rx_idx[rx_queue_idx]]; -struct sk_buff *skb = priv->rx_buf[rx_queue_idx] +struct sk_buff *skb = priv->rx_buf [priv->rx_idx[rx_queue_idx]];struct sk_buff *new_skb;
@@ -1614,7 +1614,7 @@ static void _rtl92e_rx_normal(struct net_device *dev) skb = new_skb; skb->dev = dev; - priv->rx_buf[rx_queue_idx][priv->rx_idx[rx_queue_idx]] = + priv->rx_buf[priv->rx_idx[rx_queue_idx]] = skb; *((dma_addr_t *)skb->cb) = dma_map_single(&priv->pdev->dev, skb_tail_pointer(skb),
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +1 -1
@@ -233,7 +233,7 @@ struct r8192_priv {u8 (*rf_set_chan)(struct net_device *dev,u8 ch);struct rx_desc *rx_ring; -struct sk_buff *rx_buf[MAX_RX_QUEUE ][MAX_RX_COUNT ]; +struct sk_buff *rx_buf[MAX_RX_COUNT ];dma_addr_t rx_ring_dma[MAX_RX_QUEUE ];unsigned int rx_idx[MAX_RX_QUEUE ];int rxringcount;
Signature · 1 line
2.42.0
PATCH 8/10 staging: rtl8192e: Convert array rx_ring_dma[] to variable rx_ring_dma
In reply to Philipp HortmannConvert array rx_ring_dma[] to variable rx_ring_dma as index is always 0. This increases readability.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 4 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -1
@@ -1841,7 +1841,7 @@ void rtl92e_enable_rx(struct net_device *dev) {struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv (dev); -rtl92e_writel (dev,RDQDA , priv->rx_ring_dma[RX_MPDU_QUEUE ]); +rtl92e_writel (dev,RDQDA , priv->rx_ring_dma); }static const u32 TX_DESC_BASE [] = {
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +2 -2
@@ -1159,7 +1159,7 @@ static void _rtl92e_free_rx_ring(struct net_device *dev)dma_free_coherent (&priv->pdev->dev,sizeof (*priv->rx_ring) * priv->rxringcount, priv->rx_ring, - priv->rx_ring_dma[rx_queue_idx]); + priv->rx_ring_dma); priv->rx_ring =NULL ; }
@@ -1356,7 +1356,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev) priv->rx_ring =dma_alloc_coherent (&priv->pdev->dev,sizeof (*priv->rx_ring) * priv->rxringcount, - &priv->rx_ring_dma[rx_queue_idx], + &priv->rx_ring_dma,GFP_ATOMIC );if (!priv->rx_ring || (unsigned long )priv->rx_ring &0xFF ) {netdev_warn (dev,"Cannot allocate RX ring\n" );
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +1 -1
@@ -234,7 +234,7 @@ struct r8192_priv {struct rx_desc *rx_ring;struct sk_buff *rx_buf[MAX_RX_COUNT ]; -dma_addr_t rx_ring_dma[MAX_RX_QUEUE ]; +dma_addr_t rx_ring_dma;unsigned int rx_idx[MAX_RX_QUEUE ];int rxringcount;u16 rxbuffersize;
Signature · 1 line
2.42.0
PATCH 9/10 staging: rtl8192e: Convert array rx_idx[] to variable rx_idx
In reply to Philipp HortmannConvert array rx_idx[] to variable rx_idx as index is always 0. Remove unused rx_queue_idx as well. This increases readability.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 18 +++++++----------- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +7 -11
@@ -1142,7 +1142,6 @@ static void _rtl92e_free_rx_ring(struct net_device *dev) {struct r8192_priv *priv =rtllib_priv (dev);int i; -int rx_queue_idx =0 ;for (i =0 ; i < priv->rxringcount; i++) {struct sk_buff *skb = priv->rx_buf[i];
@@ -1352,7 +1351,6 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)struct r8192_priv *priv =rtllib_priv (dev);struct rx_desc *entry =NULL ;int i; -int rx_queue_idx =0 ; priv->rx_ring = dma_alloc_coherent(&priv->pdev->dev, sizeof(*priv->rx_ring) * priv->rxringcount,
@@ -1363,7 +1361,7 @@ static short _rtl92e_alloc_rx_ring(struct net_device *dev)return -ENOMEM ; } - priv->rx_idx[rx_queue_idx] =0 ; + priv->rx_idx =0 ;for (i =0 ; i < priv->rxringcount; i++) {struct sk_buff *skb =dev_alloc_skb (priv->rxbuffersize);
@@ -1452,7 +1450,6 @@ void rtl92e_reset_desc_ring(struct net_device *dev) {struct r8192_priv *priv =rtllib_priv (dev);int i; -int rx_queue_idx =0 ;unsigned long flags =0 ;if (priv->rx_ring) {
@@ -1462,7 +1459,7 @@ void rtl92e_reset_desc_ring(struct net_device *dev) entry = &priv->rx_ring[i]; entry->OWN =1 ; } - priv->rx_idx[rx_queue_idx] =0 ; + priv->rx_idx =0 ; }spin_lock_irqsave (&priv->irq_th_lock, flags);
@@ -1561,7 +1558,6 @@ static void _rtl92e_rx_normal(struct net_device *dev)struct ieee80211_hdr *rtllib_hdr =NULL ;bool unicast_packet = false;u32 skb_len =0 ; -int rx_queue_idx =RX_MPDU_QUEUE ;struct rtllib_rx_stats stats = { .signal =0 ,
@@ -1574,9 +1570,9 @@ static void _rtl92e_rx_normal(struct net_device *dev)while (count--) {struct rx_desc *pdesc = &priv->rx_ring - [priv->rx_idx[rx_queue_idx]]; + [priv->rx_idx];struct sk_buff *skb = priv->rx_buf - [priv->rx_idx[rx_queue_idx]]; + [priv->rx_idx];struct sk_buff *new_skb;if (pdesc->OWN)
@@ -1614,7 +1610,7 @@ static void _rtl92e_rx_normal(struct net_device *dev) skb = new_skb; skb->dev = dev; - priv->rx_buf[priv->rx_idx[rx_queue_idx]] = + priv->rx_buf[priv->rx_idx] = skb; *((dma_addr_t *)skb->cb) = dma_map_single(&priv->pdev->dev, skb_tail_pointer(skb),
@@ -1627,9 +1623,9 @@ static void _rtl92e_rx_normal(struct net_device *dev) pdesc->BufferAddress = *((dma_addr_t *)skb->cb); pdesc->OWN =1 ; pdesc->Length = priv->rxbuffersize; -if (priv->rx_idx[rx_queue_idx] == priv->rxringcount -1 ) +if (priv->rx_idx == priv->rxringcount -1 ) pdesc->EOR =1 ; - priv->rx_idx[rx_queue_idx] = (priv->rx_idx[rx_queue_idx] +1 ) % + priv->rx_idx = (priv->rx_idx +1 ) % priv->rxringcount; } }
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +1 -1
@@ -235,7 +235,7 @@ struct r8192_priv {struct rx_desc *rx_ring;struct sk_buff *rx_buf[MAX_RX_COUNT ];dma_addr_t rx_ring_dma; -unsigned int rx_idx[MAX_RX_QUEUE ]; +unsigned int rx_idx;int rxringcount;u16 rxbuffersize;
Signature · 1 line
2.42.0
PATCH 10/10 staging: rtl8192e: Remove unused constants starting with MAX_RX_QUEUE
In reply to Philipp HortmannRemove unused constants.
--- .../staging/rtl8192e/rtl8192e/r8190P_def.h | 2 - .../staging/rtl8192e/rtl8192e/r8192E_phyreg.h | 62 +------------------ drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 2 - drivers/staging/rtl8192e/rtl819x_Qos.h | 1 - drivers/staging/rtl8192e/rtl819x_TS.h | 1 - drivers/staging/rtl8192e/rtllib.h | 1 - 6 files changed, 1 insertion(+), 68 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8190P_def.h +0 -2
@@ -11,8 +11,6 @@#define MAX_SILENT_RESET_RX_SLOT_NUM 10 -#define RX_MPDU_QUEUE 0 -enum rtl819x_loopback {RTL819X_NO_LOOPBACK =0 ,RTL819X_MAC_LOOPBACK =1 ,
drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h +1 -61
76 lines not on this page · raw message
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -2
@@ -91,8 +91,6 @@#define MAX_TX_QUEUE 9 -#define MAX_RX_QUEUE 1 -#define MAX_RX_COUNT 64#define MAX_TX_QUEUE_COUNT 9
drivers/staging/rtl8192e/rtl819x_Qos.h +0 -1
@@ -21,7 +21,6 @@ struct octet_string {#define AC1_BK 1#define AC2_VI 2#define AC3_VO 3 -#define AC_MAX 4enum direction_value {DIR_UP =0 ,
drivers/staging/rtl8192e/rtl819x_TS.h +0 -1
@@ -10,7 +10,6 @@#define TS_ADDBA_DELAY 60#define TOTAL_TS_NUM 16 -#define TCLAS_NUM 4enum tr_select {TX_DIR =0 ,
drivers/staging/rtl8192e/rtllib.h +0 -1
@@ -911,7 +911,6 @@ enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame}; ((up) < 6) ? WME_AC_VI : \ WME_AC_VO) -#define ETHER_ADDR_LEN 6/* length of an Ethernet address */ #define ETHERNET_HEADER_SIZE 14/* length of two Ethernet address * plus ether type */
Signature · 1 line
2.42.0
Re: [PATCH 09/10] staging: rtl8192e: Convert array rx_idx[] to variable rx_idx
In reply to Philipp Hortmanndrivers/staging/rtl8192e/rtl8192e/rtl_core.c static void _rtl92e_rx_normal(struct net_device *dev) · line 1614
Quoted 7 lines · Philipp Hortmann
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1
-1@@ -1614,7 +1610,7 @@ static void _rtl92e_rx_normal(struct net_device *dev) skb = new_skb; skb->dev = dev; - priv->rx_buf[priv->rx_idx[rx_queue_idx]] = + priv->rx_buf[priv->rx_idx] = skb;
I really like how you split these patches up. Like there was a bunch of different ways to do that and you chose one which made it so easy to review. You made the right choice to avoid touching unrelated white space issues.
But could you send a follow on patch to move this lonely skb back with his friends?
regards,
dan carpenter
Quoted 7 lines · Philipp Hortmann
Remove some functions that always return false or zero.
Remove a loop that is always executed one time and convert arrays to variables. Remove some unused constants.Tested with rtl8192e (WLL6130-D99) in Mode n (12.5 MB/s) Transferred this patch over wlan connection of rtl8192e.
Quoted 12 lines
Philipp Hortmann (10):
staging: rtl8192e: RemoveHTIOTActIsDisableMCS14()
staging: rtl8192e: RemoveHTIOTActIsDisableMCS15()
staging: rtl8192e: RemoveHTIOTActIsDisableMCSTwoSpatialStream()
staging: rtl8192e: RemoveHTIOTActIsDisableEDCATurbo()
staging: rtl8192e: Remove loops with constantMAX_RX_QUEUE
staging: rtl8192e: Convert array rx_ring[] to variablerx_ring
staging: rtl8192e: Convert array rx_buf[][] to array rx_buf[]
staging: rtl8192e: Convert array rx_ring_dma[] to variablerx_ring_dma
staging: rtl8192e: Convert array rx_idx[] to variablerx_idx
staging: rtl8192e: Remove unused constants starting withMAX_RX_QUEUE
Looks good to me.
regards,
dan carpenter