Print this page
5255 uts shouldn't open-code ISP2


   2  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  */
   5 
   6 /*
   7  * Copyright (c) 2008 Atheros Communications Inc.
   8  *
   9  * Permission to use, copy, modify, and/or distribute this software for any
  10  * purpose with or without fee is hereby granted, provided that the above
  11  * copyright notice and this permission notice appear in all copies.
  12  *
  13  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  15  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  16  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  18  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  19  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  20  */
  21 

  22 #include <sys/param.h>
  23 #include <sys/types.h>
  24 #include <sys/signal.h>
  25 #include <sys/stream.h>
  26 #include <sys/termio.h>
  27 #include <sys/errno.h>
  28 #include <sys/file.h>
  29 #include <sys/cmn_err.h>
  30 #include <sys/stropts.h>
  31 #include <sys/strsubr.h>
  32 #include <sys/strtty.h>
  33 #include <sys/kbio.h>
  34 #include <sys/cred.h>
  35 #include <sys/stat.h>
  36 #include <sys/consdev.h>
  37 #include <sys/kmem.h>
  38 #include <sys/modctl.h>
  39 #include <sys/ddi.h>
  40 #include <sys/sunddi.h>
  41 #include <sys/pci.h>


2628 #define ATH9K_HT_CAP_MPDUDENSITY_8 0x6          /* 8 usec */
2629 
2630         /* LINTED E_FUNC_SET_NOT_USED */
2631         uint8_t tx_streams;
2632         uint8_t rx_streams;
2633 
2634         arn_ht_conf *ht_info = &sc->sc_ht_conf;
2635 
2636         ht_info->ht_supported = B_TRUE;
2637 
2638         /* Todo: IEEE80211_HTCAP_SMPS */
2639         ht_info->cap = IEEE80211_HTCAP_CHWIDTH40|
2640             IEEE80211_HTCAP_SHORTGI40 |
2641             IEEE80211_HTCAP_DSSSCCK40;
2642 
2643         ht_info->ampdu_factor = ATH9K_HT_CAP_MAXRXAMPDU_65536;
2644         ht_info->ampdu_density = ATH9K_HT_CAP_MPDUDENSITY_8;
2645 
2646         /* set up supported mcs set */
2647         (void) memset(&ht_info->rx_mcs_mask, 0, sizeof (ht_info->rx_mcs_mask));
2648         tx_streams =
2649             !(sc->sc_ah->ah_caps.tx_chainmask &
2650             (sc->sc_ah->ah_caps.tx_chainmask - 1)) ? 1 : 2;
2651         rx_streams =
2652             !(sc->sc_ah->ah_caps.rx_chainmask &
2653             (sc->sc_ah->ah_caps.rx_chainmask - 1)) ? 1 : 2;
2654 
2655         ht_info->rx_mcs_mask[0] = 0xff;
2656         if (rx_streams >= 2)
2657                 ht_info->rx_mcs_mask[1] = 0xff;
2658 }
2659 
2660 /* xxx should be used for ht rate set negotiating ? */
2661 static void
2662 arn_overwrite_11n_rateset(struct arn_softc *sc)
2663 {
2664         uint8_t *ht_rs = sc->sc_ht_conf.rx_mcs_mask;
2665         int mcs_idx, mcs_count = 0;
2666         int i, j;
2667 
2668         (void) memset(&ieee80211_rateset_11n, 0,
2669             sizeof (ieee80211_rateset_11n));
2670         for (i = 0; i < 10; i++) {
2671                 for (j = 0; j < 8; j++) {
2672                         if (ht_rs[i] & (1 << j)) {
2673                                 mcs_idx = i * 8 + j;




   2  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  */
   5 
   6 /*
   7  * Copyright (c) 2008 Atheros Communications Inc.
   8  *
   9  * Permission to use, copy, modify, and/or distribute this software for any
  10  * purpose with or without fee is hereby granted, provided that the above
  11  * copyright notice and this permission notice appear in all copies.
  12  *
  13  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  15  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  16  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  18  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  19  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  20  */
  21 
  22 #include <sys/sysmacros.h>
  23 #include <sys/param.h>
  24 #include <sys/types.h>
  25 #include <sys/signal.h>
  26 #include <sys/stream.h>
  27 #include <sys/termio.h>
  28 #include <sys/errno.h>
  29 #include <sys/file.h>
  30 #include <sys/cmn_err.h>
  31 #include <sys/stropts.h>
  32 #include <sys/strsubr.h>
  33 #include <sys/strtty.h>
  34 #include <sys/kbio.h>
  35 #include <sys/cred.h>
  36 #include <sys/stat.h>
  37 #include <sys/consdev.h>
  38 #include <sys/kmem.h>
  39 #include <sys/modctl.h>
  40 #include <sys/ddi.h>
  41 #include <sys/sunddi.h>
  42 #include <sys/pci.h>


2629 #define ATH9K_HT_CAP_MPDUDENSITY_8 0x6          /* 8 usec */
2630 
2631         /* LINTED E_FUNC_SET_NOT_USED */
2632         uint8_t tx_streams;
2633         uint8_t rx_streams;
2634 
2635         arn_ht_conf *ht_info = &sc->sc_ht_conf;
2636 
2637         ht_info->ht_supported = B_TRUE;
2638 
2639         /* Todo: IEEE80211_HTCAP_SMPS */
2640         ht_info->cap = IEEE80211_HTCAP_CHWIDTH40|
2641             IEEE80211_HTCAP_SHORTGI40 |
2642             IEEE80211_HTCAP_DSSSCCK40;
2643 
2644         ht_info->ampdu_factor = ATH9K_HT_CAP_MAXRXAMPDU_65536;
2645         ht_info->ampdu_density = ATH9K_HT_CAP_MPDUDENSITY_8;
2646 
2647         /* set up supported mcs set */
2648         (void) memset(&ht_info->rx_mcs_mask, 0, sizeof (ht_info->rx_mcs_mask));
2649         tx_streams = ISP2(sc->sc_ah->ah_caps.tx_chainmask) ? 1 : 2;
2650         rx_streams = ISP2(sc->sc_ah->ah_caps.rx_chainmask) ? 1 : 2;




2651 
2652         ht_info->rx_mcs_mask[0] = 0xff;
2653         if (rx_streams >= 2)
2654                 ht_info->rx_mcs_mask[1] = 0xff;
2655 }
2656 
2657 /* xxx should be used for ht rate set negotiating ? */
2658 static void
2659 arn_overwrite_11n_rateset(struct arn_softc *sc)
2660 {
2661         uint8_t *ht_rs = sc->sc_ht_conf.rx_mcs_mask;
2662         int mcs_idx, mcs_count = 0;
2663         int i, j;
2664 
2665         (void) memset(&ieee80211_rateset_11n, 0,
2666             sizeof (ieee80211_rateset_11n));
2667         for (i = 0; i < 10; i++) {
2668                 for (j = 0; j < 8; j++) {
2669                         if (ht_rs[i] & (1 << j)) {
2670                                 mcs_idx = i * 8 + j;