Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/dev/pci Convert most of ipw_attach to phil-.



details:   https://anonhg.NetBSD.org/src-all/rev/ebe2b844539f
branches:  trunk
changeset: 371645:ebe2b844539f
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Sun Mar 06 03:49:07 2022 +1100

description:
Convert most of ipw_attach to phil-.

diffstat:

 sys/dev/pci/if_ipw.c |  39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diffs (90 lines):

diff -r b518c01ce64d -r ebe2b844539f sys/dev/pci/if_ipw.c
--- a/sys/dev/pci/if_ipw.c      Sun Mar 06 03:22:03 2022 +1100
+++ b/sys/dev/pci/if_ipw.c      Sun Mar 06 03:49:07 2022 +1100
@@ -264,24 +264,27 @@
                goto fail;
        }
 
-       ifp->if_softc = sc;
-       ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-       ifp->if_start = ipw_start;
+       ic->ic_name = device_xname(self);
+       ic->ic_txsream = 1; /* XXX */
+       ic->ic_rxsream = 1; /* XXX */
+       ic->ic_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+
        ifp->if_watchdog = ipw_watchdog;
        IFQ_SET_READY(&ifp->if_snd);
-       strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
-
-       ic->ic_ifp = ifp;
+
+       ic->ic_softc = sc;
        ic->ic_phytype = IEEE80211_T_DS;
        ic->ic_opmode = IEEE80211_M_STA;
-       ic->ic_state = IEEE80211_S_INIT;
 
        /* set device capabilities */
        ic->ic_caps =
-             IEEE80211_C_SHPREAMBLE    /* short preamble supported */
+           IEEE80211_C_STA             /* station (AP) mode supported */
+           | IEEE80211_C_SHPREAMBLE    /* short preamble supported */
            | IEEE80211_C_TXPMGT        /* tx power management */
            | IEEE80211_C_IBSS          /* ibss mode */
            | IEEE80211_C_MONITOR       /* monitor mode */
+           | IEEE80211_C_WME           /* 802.11e */
+           IEEE80211_C_WPA;            /* WPA/RSN. */
            ;
 
        /* read MAC address from EEPROM */
@@ -295,6 +298,7 @@
        ic->ic_myaddr[4] = val >> 8;
        ic->ic_myaddr[5] = val & 0xff;
 
+#if 0
        /* set supported .11b rates */
        ic->ic_sup_rates[IEEE80211_MODE_11B] = ieee80211_std_rateset_11b;
 
@@ -309,6 +313,9 @@
                        ic->ic_channels[i].ic_flags = IEEE80211_CHAN_B;
                }
        }
+#endif
+       ipw_get_radiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_rchans,
+           ic->ic_channels);
 
        /* check support for radio transmitter switch in EEPROM */
        if (!(ipw_read_prom_word(sc, IPW_EEPROM_RADIO) & 8))
@@ -317,15 +324,15 @@
        aprint_normal_dev(sc->sc_dev, "802.11 address %s\n",
            ether_sprintf(ic->ic_myaddr));
 
-       if_initialize(ifp);
        ieee80211_ifattach(ic);
        /* Use common softint-based if_input */
        ifp->if_percpuq = if_percpuq_create(ifp);
-       if_register(ifp);
-
-       /* override state transition machine */
-       sc->sc_newstate = ic->ic_newstate;
-       ic->ic_newstate = ipw_newstate;
+
+       /* override default methods */
+       ic->ic_vap_create = ipw_vap_create;
+       ic->ic_vap_delete = ipw_vap_delete;
+       ic->ic_getradiocaps = ipw_get_radiocaps;
+       ic->ic_parent = ipw_parent;
 
        ieee80211_media_init(ic, ipw_media_change, ipw_media_status);
 
@@ -340,6 +347,10 @@
        sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len);
        sc->sc_txtap.wt_ihdr.it_present = htole32(IPW_TX_RADIOTAP_PRESENT);
 
+       /* let the stack know we support radiotap */
+       ic->ic_rh = &sc->sc_rxtapu.th.wr_ihdr;
+       ic->ic_th = &sc->sc_txtapu.th.wt_ihdr;
+
        /*
         * Add a few sysctl knobs.
         * XXX: Not yet



Home | Main Index | Thread Index | Old Index