From: Ivo van Doorn <[EMAIL PROTECTED]>

Store rx_params seperately outside the ring structure.
This is more safer and required because of some changes
in the way the rings are stored in the structure in the following
patches.

Signed-off-by: Ivo van Doorn <[EMAIL PROTECTED]>

diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2400pci.c 
wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2400pci.c  
2006-04-27 21:47:22.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2400pci.c    
2006-04-27 21:47:52.000000000 +0200
@@ -475,8 +475,8 @@ rt2400pci_config_channel(struct rt2x00_p
        /*
         * Update active info for RX.
         */
-       rt2x00pci->rx.params.rx.freq = freq;
-       rt2x00pci->rx.params.rx.channel = channel;
+       rt2x00pci->rx_params.freq = freq;
+       rt2x00pci->rx_params.channel = channel;
 
        /*
         * Clear false CRC during channel switch.
@@ -534,7 +534,7 @@ rt2400pci_config_antenna(struct rt2x00_p
        /*
         * Update active info for RX.
         */
-       rt2x00pci->rx.params.rx.antenna = antenna;
+       rt2x00pci->rx_params.antenna = antenna;
 }
 
 static void
@@ -814,10 +814,10 @@ rt2400pci_rxdone(void *data)
 
                        memcpy(skb_put(skb, size), entry->data_addr, size);
 
-                       ring->params.rx.ssi =
+                       rt2x00pci->rx_params.ssi =
                                rt2x00_get_field32(rxd->word2, RXD_W2_RSSI);
 
-                       __ieee80211_rx(net_dev, skb, &ring->params.rx);
+                       __ieee80211_rx(net_dev, skb, &rt2x00pci->rx_params);
                }
 
                rt2x00_set_field32(&rxd->word0, RXD_W0_OWNER_NIC, 1);
@@ -981,8 +981,8 @@ rt2400pci_alloc_ring(
        /*
         * Initialize ring parameters.
         */
-       ring->params.tx.cw_min = 5;     /* cw_min: 2^5 = 32. */
-       ring->params.tx.cw_max = 10;    /* cw_max: 2^10 = 1024. */
+       ring->tx_params.cw_min = 5;     /* cw_min: 2^5 = 32. */
+       ring->tx_params.cw_max = 10;    /* cw_max: 2^10 = 1024. */
 
        rt2x00_ring_index_clear(ring);
 
@@ -1374,7 +1374,7 @@ rt2400pci_tx(struct net_device *net_dev,
         * queue. This is the alternative since we cannot
         * set the CWmin and CWmax per descriptor.
         */
-       rt2400pci_config_cw(rt2x00pci, &ring->params.tx);
+       rt2400pci_config_cw(rt2x00pci, &ring->tx_params);
        rt2x00_register_write(rt2x00pci, TXCSR0, reg);
 
        return 0;
@@ -1544,7 +1544,7 @@ rt2400pci_config_update(void *data)
        /*
         * Update active info for RX.
         */
-       rt2x00pci->rx.params.rx.phymode = conf->phymode;
+       rt2x00pci->rx_params.phymode = conf->phymode;
 }
 
 static int
@@ -1599,7 +1599,7 @@ rt2400pci_scan(void *data)
         * Switch channel and update active info for RX.
         */
        if (rt2x00pci->scan->state == IEEE80211_SCAN_START) {
-               rt2x00pci->rx.params.rx.phymode =
+               rt2x00pci->rx_params.phymode =
                        rt2x00pci->scan->conf.scan_phymode;
 
                rt2400pci_config_channel(rt2x00pci,
@@ -1610,7 +1610,7 @@ rt2400pci_scan(void *data)
                rt2400pci_config_txpower(rt2x00pci,
                        rt2x00pci->scan->conf.scan_power_level);
        } else {
-               rt2x00pci->rx.params.rx.phymode =
+               rt2x00pci->rx_params.phymode =
                        rt2x00pci->scan->conf.running_phymode;
 
                rt2400pci_config_channel(rt2x00pci,
@@ -1726,7 +1726,7 @@ rt2400pci_conf_tx(struct net_device *net
        else
                return -EINVAL;
 
-       memcpy(&ring->params, params, sizeof(*params));
+       memcpy(&ring->tx_params, params, sizeof(*params));
 
        /*
         * TODO: We can't use different cw_min and cw_max variables
@@ -1737,14 +1737,14 @@ rt2400pci_conf_tx(struct net_device *net
         * RT2400 registers require to know the bit number 'n'.
         */
        if (params->cw_min)
-               ring->params.tx.cw_min = HIGHEST_BIT16(params->cw_min) + 1;
+               ring->tx_params.cw_min = HIGHEST_BIT16(params->cw_min) + 1;
        else
-               ring->params.tx.cw_min = 5; /* cw_min: 2^5 = 32. */
+               ring->tx_params.cw_min = 5; /* cw_min: 2^5 = 32. */
 
        if (params->cw_max)
-               ring->params.tx.cw_max = HIGHEST_BIT16(params->cw_max) + 1;
+               ring->tx_params.cw_max = HIGHEST_BIT16(params->cw_max) + 1;
        else
-               ring->params.tx.cw_max = 10; /* cw_min: 2^10 = 1024. */
+               ring->tx_params.cw_max = 10; /* cw_min: 2^10 = 1024. */
 
        return 0;
 }
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2400pci.h 
wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2400pci.h
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2400pci.h  
2006-04-27 21:47:22.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2400pci.h    
2006-04-27 21:47:52.000000000 +0200
@@ -926,6 +926,11 @@ struct rt2x00_pci{
        struct workqueue_struct         *workqueue;
 
        /*
+        * RX ring parameters.
+        */
+       struct ieee80211_rx_status              rx_params;
+
+       /*
         * False CCA count.
         */
        int                                     false_cca;
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500pci.c 
wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500pci.c  
2006-04-27 21:47:22.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500pci.c    
2006-04-27 21:47:52.000000000 +0200
@@ -510,8 +510,8 @@ rt2500pci_config_channel(struct rt2x00_p
        /*
         * Update active info for RX.
         */
-       rt2x00pci->rx.params.rx.freq = freq;
-       rt2x00pci->rx.params.rx.channel = channel;
+       rt2x00pci->rx_params.freq = freq;
+       rt2x00pci->rx_params.channel = channel;
 
        /*
         * Clear false CRC during channel switch.
@@ -589,7 +589,7 @@ rt2500pci_config_antenna(struct rt2x00_p
        /*
         * Update active info for RX.
         */
-       rt2x00pci->rx.params.rx.antenna = antenna;
+       rt2x00pci->rx_params.antenna = antenna;
 }
 
 static void
@@ -733,16 +733,16 @@ rt2500pci_write_tx_desc(
        rt2x00_set_field32(&txd->word0, TXD_W0_ACK, !control->no_ack);
 
        if (control->queue == IEEE80211_TX_QUEUE_DATA0) {
-               params = &rt2x00pci->prio.params.tx;
+               params = &rt2x00pci->prio.tx_params;
                rt2x00_set_field32(&txd->word0, TXD_W0_TIMESTAMP, 0);
        } else if (control->queue == IEEE80211_TX_QUEUE_DATA1) {
-               params = &rt2x00pci->tx.params.tx;
+               params = &rt2x00pci->tx.tx_params;
                rt2x00_set_field32(&txd->word0, TXD_W0_TIMESTAMP, 0);
        } else if (IEEE80211_TX_QUEUE_AFTER_BEACON) {
-               params = &rt2x00pci->atim.params.tx;
+               params = &rt2x00pci->atim.tx_params;
                rt2x00_set_field32(&txd->word0, TXD_W0_TIMESTAMP, 0);
        } else if (IEEE80211_TX_QUEUE_BEACON) {
-               params = &rt2x00pci->beacon.params.tx;
+               params = &rt2x00pci->beacon.tx_params;
                rt2x00_set_field32(&txd->word0, TXD_W0_TIMESTAMP, 1);
        }
 
@@ -896,13 +896,13 @@ rt2500pci_rxdone(void *data)
 
                        memcpy(skb_put(skb, size), entry->data_addr, size);
 
-                       ring->params.rx.ssi =
+                       rt2x00pci->rx_params.ssi =
                                rt2x00_get_field32(rxd->word2, RXD_W2_RSSI);
 
-                       __ieee80211_rx(net_dev, skb, &ring->params.rx);
+                       __ieee80211_rx(net_dev, skb, &rt2x00pci->rx_params);
 
                        rssi_count++;
-                       total_rssi += ring->params.rx.ssi;
+                       total_rssi += rt2x00pci->rx_params.ssi;
                }
                rt2x00_set_field32(&rxd->word0, RXD_W0_OWNER_NIC, 1);
 
@@ -1066,9 +1066,9 @@ rt2500pci_alloc_ring(
        /*
         * Initialize ring parameters.
         */
-       ring->params.tx.aifs = 2;
-       ring->params.tx.cw_min = 5;     /* cw_min: 2^5 = 32. */
-       ring->params.tx.cw_max = 10;    /* cw_max: 2^10 = 1024. */
+       ring->tx_params.aifs = 2;
+       ring->tx_params.cw_min = 5;     /* cw_min: 2^5 = 32. */
+       ring->tx_params.cw_max = 10;    /* cw_max: 2^10 = 1024. */
 
        rt2x00_ring_index_clear(ring);
 
@@ -1657,7 +1657,7 @@ rt2500pci_config_update(void *data)
        /*
         * Update active info for RX.
         */
-       rt2x00pci->rx.params.rx.phymode = conf->phymode;
+       rt2x00pci->rx_params.phymode = conf->phymode;
 }
 
 static int
@@ -1712,7 +1712,7 @@ rt2500pci_scan(void *data)
         * Switch channel and update active info for RX.
         */
        if (rt2x00pci->scan->state == IEEE80211_SCAN_START) {
-               rt2x00pci->rx.params.rx.phymode =
+               rt2x00pci->rx_params.phymode =
                        rt2x00pci->scan->conf.scan_phymode;
        
                rt2500pci_config_channel(rt2x00pci,
@@ -1721,7 +1721,7 @@ rt2500pci_scan(void *data)
                        rt2x00pci->scan->conf.scan_freq,
                        rt2x00pci->scan->conf.scan_power_level);
        } else {
-               rt2x00pci->rx.params.rx.phymode =
+               rt2x00pci->rx_params.phymode =
                        rt2x00pci->scan->conf.running_phymode;
        
                rt2500pci_config_channel(rt2x00pci,
@@ -1835,24 +1835,24 @@ rt2500pci_conf_tx(struct net_device *net
        else
                return -EINVAL;
 
-       memcpy(&ring->params, params, sizeof(*params));
+       memcpy(&ring->tx_params, params, sizeof(*params));
 
        /*
         * The passed variables are stored as real value ((2^n)-1).
         * RT2400 registers require to know the bit number 'n'.
         */
        if (params->cw_min)
-               ring->params.tx.cw_min = HIGHEST_BIT16(params->cw_min) + 1;
+               ring->tx_params.cw_min = HIGHEST_BIT16(params->cw_min) + 1;
        else
-               ring->params.tx.cw_min = 5; /* cw_min: 2^5 = 32. */
+               ring->tx_params.cw_min = 5; /* cw_min: 2^5 = 32. */
 
        if (params->cw_max)
-               ring->params.tx.cw_max = HIGHEST_BIT16(params->cw_max) + 1;
+               ring->tx_params.cw_max = HIGHEST_BIT16(params->cw_max) + 1;
        else
-               ring->params.tx.cw_max = 10; /* cw_min: 2^10 = 1024. */
+               ring->tx_params.cw_max = 10; /* cw_min: 2^10 = 1024. */
 
        if (!params->aifs)
-               ring->params.tx.aifs = 2;
+               ring->tx_params.aifs = 2;
 
        return 0;
 }
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500pci.h 
wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500pci.h
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500pci.h  
2006-04-27 21:47:22.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500pci.h    
2006-04-27 21:47:52.000000000 +0200
@@ -1196,6 +1196,11 @@ struct rt2x00_pci{
        struct workqueue_struct         *workqueue;
 
        /*
+        * RX ring parameters.
+        */
+       struct ieee80211_rx_status              rx_params;
+
+       /*
         * Alignment.
         */
        u16                                     __pad;
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500usb.c 
wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500usb.c  
2006-04-27 21:47:22.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500usb.c    
2006-04-27 21:47:52.000000000 +0200
@@ -435,7 +435,7 @@ rt2500usb_config_antenna(struct rt2x00_u
        /*
         * Update active info for RX.
         */
-       rt2x00usb->rx.params.rx.antenna = antenna;
+       rt2x00usb->rx_params.antenna = antenna;
 }
 
 static void
@@ -573,16 +573,16 @@ rt2500usb_write_tx_desc(
        rt2x00_set_field32(&txd->word0, TXD_W0_ACK, !control->no_ack);
 
        if (control->queue == IEEE80211_TX_QUEUE_DATA0) {
-               params = &rt2x00usb->prio.params.tx;
+               params = &rt2x00usb->prio.tx_params;
                rt2x00_set_field32(&txd->word0, TXD_W0_TIMESTAMP, 0);
        } else if (control->queue == IEEE80211_TX_QUEUE_DATA1) {
-               params = &rt2x00usb->tx.params.tx;
+               params = &rt2x00usb->tx.tx_params;
                rt2x00_set_field32(&txd->word0, TXD_W0_TIMESTAMP, 0);
        } else if (IEEE80211_TX_QUEUE_AFTER_BEACON) {
-               params = &rt2x00usb->atim.params.tx;
+               params = &rt2x00usb->atim.tx_params;
                rt2x00_set_field32(&txd->word0, TXD_W0_TIMESTAMP, 0);
        } else if (IEEE80211_TX_QUEUE_BEACON) {
-               params = &rt2x00usb->beacon.params.tx;
+               params = &rt2x00usb->beacon.tx_params;
                rt2x00_set_field32(&txd->word0, TXD_W0_TIMESTAMP, 1);
        }
 
@@ -740,13 +740,13 @@ rt2500usb_rxdone(void *data)
 
                        memcpy(skb_put(skb, size), entry->data_addr, size);
 
-                       ring->params.rx.ssi =
+                       rt2x00usb->rx_params.ssi =
                                rt2x00_get_field32(rxd->word1, RXD_W1_RSSI);
 
-                       __ieee80211_rx(net_dev, skb, &ring->params.rx);
+                       __ieee80211_rx(net_dev, skb, &rt2x00usb->rx_params);
 
                        rssi_count++;
-                       total_rssi += ring->params.rx.ssi;
+                       total_rssi += rt2x00usb->rx_params.ssi;
                }
 
                usb_submit_urb(entry->urb, GFP_ATOMIC);
@@ -855,9 +855,9 @@ rt2500usb_alloc_ring(
        /*
         * Initialize ring parameters.
         */
-       ring->params.tx.aifs = 2;
-       ring->params.tx.cw_min = 5;     /* cw_min: 2^5 = 32. */
-       ring->params.tx.cw_max = 10;    /* cw_max: 2^10 = 1024. */
+       ring->tx_params.aifs = 2;
+       ring->tx_params.cw_min = 5;     /* cw_min: 2^5 = 32. */
+       ring->tx_params.cw_max = 10;    /* cw_max: 2^10 = 1024. */
 
        rt2x00_ring_index_clear(ring);
 
@@ -1394,7 +1394,7 @@ rt2500usb_config_update(void *data)
        /*
         * Update active info for RX.
         */
-       rt2x00usb->rx.params.rx.phymode = conf->phymode;
+       rt2x00usb->rx_params.phymode = conf->phymode;
 }
 
 static int
@@ -1450,7 +1450,7 @@ rt2500usb_scan(void *data)
         * Switch channel and update active info for RX.
         */
        if (rt2x00usb->scan->state == IEEE80211_SCAN_START) {
-               rt2x00usb->rx.params.rx.phymode =
+               rt2x00usb->rx_params.phymode =
                        rt2x00usb->scan->conf.scan_phymode;
        
                rt2500usb_config_channel(rt2x00usb,
@@ -1459,7 +1459,7 @@ rt2500usb_scan(void *data)
                        rt2x00usb->scan->conf.scan_freq,
                        rt2x00usb->scan->conf.scan_power_level);
        } else {
-               rt2x00usb->rx.params.rx.phymode =
+               rt2x00usb->rx_params.phymode =
                        rt2x00usb->scan->conf.running_phymode;
        
                rt2500usb_config_channel(rt2x00usb,
@@ -1558,24 +1558,24 @@ rt2500usb_conf_tx(struct net_device *net
        else
                return -EINVAL;
 
-       memcpy(&ring->params, params, sizeof(*params));
+       memcpy(&ring->tx_params, params, sizeof(*params));
 
        /*
         * The passed variables are stored as real value ((2^n)-1).
         * RT2400 registers require to know the bit number 'n'.
         */
        if (params->cw_min)
-               ring->params.tx.cw_min = HIGHEST_BIT16(params->cw_min) + 1;
+               ring->tx_params.cw_min = HIGHEST_BIT16(params->cw_min) + 1;
        else
-               ring->params.tx.cw_min = 5; /* cw_min: 2^5 = 32. */
+               ring->tx_params.cw_min = 5; /* cw_min: 2^5 = 32. */
 
        if (params->cw_max)
-               ring->params.tx.cw_max = HIGHEST_BIT16(params->cw_max) + 1;
+               ring->tx_params.cw_max = HIGHEST_BIT16(params->cw_max) + 1;
        else
-               ring->params.tx.cw_max = 10; /* cw_min: 2^10 = 1024. */
+               ring->tx_params.cw_max = 10; /* cw_min: 2^10 = 1024. */
 
        if (!params->aifs)
-               ring->params.tx.aifs = 2;
+               ring->tx_params.aifs = 2;
 
        return 0;
 }
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500usb.h 
wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500usb.h
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500usb.h  
2006-04-27 21:47:22.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500usb.h    
2006-04-27 21:47:52.000000000 +0200
@@ -714,6 +714,11 @@ struct rt2x00_usb{
        struct workqueue_struct         *workqueue;
 
        /*
+        * RX ring parameters.
+        */
+       struct ieee80211_rx_status              rx_params;
+
+       /*
         * Alignment.
         */
        u8                                      __pad1;
diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2x00.h 
wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2x00.h
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2x00.h     
2006-04-27 21:39:24.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2x00.h       
2006-04-27 21:47:52.000000000 +0200
@@ -465,19 +465,9 @@ struct data_ring{
        struct ieee80211_tx_queue_stats_data    stats;
 
        /*
-        * Queue parameters.
-        * We can safely put the following structures inside
-        * the same union since a ring is either TX or RX
-        * so they will never be used at the same time.
-        * The ieee80211_rx_status structures is stored here, when
-        * configuration changes have been passed to us, we can
-        * change it to show the active configuration. And received
-        * frames will always have the correct settings.
-        */
-       union {
-               struct ieee80211_rx_status              rx;
-               struct ieee80211_tx_queue_params        tx;
-       }                                       params;
+        * TX Queue parameters.
+        */
+       struct ieee80211_tx_queue_params        tx_params;
 
        /*
         * Base address for data ring.

Attachment: pgpqKy9qBnP3U.pgp
Description: PGP signature

Reply via email to