Hi Quaker,

usr/src/uts/common/io/net80211/net80211.c:
void *
ieee80211_malloc(size_t size)
{
        void *p = kmem_zalloc((size + 4), KM_SLEEP);
        *(int *)p = size;
        p = (char *)p + 4;

        return (p);
}
This assumes 32bit alignment. It can potentially cause "bus error" on SPARC due 
to misaligned access to 64bit integers.
kmem_zalloc() gurantees to return a double-word aligned pointer because of this 
reason. ieee80211_malloc should do the same.


usr/src/uts/common/io/ath/ath_aux.c:
1. key_alloc_2pair(): "goto again" makes the logic really complex. Should 
(i+1)*NBBY be (i+1)*NBBY-1 instead? 
It'd be nice if the logic can be simplified. For example:

        #define IS_BIT_SET (isset(asc->asc_keymap, keyix+32) || \
                            isset(asc->asc_keymap, keyix+64) || \
                            isset(asc->asc_keymap, keyix+32+64))
        nextB = (i+1)*NBBY;
        while(keyix < nextB && ((b & 1) || IS_BIT_SET(keyix))) {
                keyix ++;
                b >>=1;
        }
        if (keyix >= nextB)
                continue;
        setbit(asc->asc_keymap, keyix);
        ...
2. It'd look nicer if the following groups of calls are defined as meaningful 
macros, e.g.:
#define SET_XXX_BITS(keyix) \
                        setbit(asc->asc_keymap, keyix+64);
                        setbit(asc->asc_keymap, keyix+32);
                        setbit(asc->asc_keymap, keyix+32+64);
        
#define CLR_XXX_BITS(keyix) \
                        clrbit(asc->asc_keymap, keyix+64); /* TX key MIC */ \
                        clrbit(asc->asc_keymap, keyix+32);      /* RX key */ \
                        clrbit(asc->asc_keymap, keyix+32+64);   /* RX key MIC */


Cheers.
Vincent.

Quaker Fang wrote:

> Wireless WPA Supplicant (PSARC/2006/046) is now ready for code review.
> This work consists of a new wpa SMF service, along with WPA-related
> changes to dladm(1M), libdladm, and the mac_wifi, ath, and net80211
> kernel modules.
>
> This project consists of almost 10,000 changed or new lines of code.
> To make the review more manageable, we are splitting it into two parts.
>
> This is the first part, and consists of everything but[1] the net80211
> kernel module, ath driver and mac_wifi plugin changes.
> The second part will be sent out for review later.
>
>     webrev: http://cr.grommit.com/~zf162725/cr_0308/
>     workspace & cscope: /net/greatwall.prc/workspace/wifi-wpa-cr/usr/src
>
> Please provide feedback to this list.  The review timer is set for two
> weeks (03/22/2007).
>
> Several Sun employees have graciously agreed to do the review
> (assignments are listed below), but we welcome comments from the
> community at-large.
>
> For part 1, there are 38 files to be reviewed, split into six areas:
>
>     1. WPA protocol:        3 files,  ~3100 lines new
>        wpa.c, wpa_supplicant, wpa_impl.h
>
>     2. DLPI related:        3 files,  ~260  lines new
>        l2_packet.[ch], ethernet.h
>
>     3. Misc:                6 files,  ~1200 lines new
>        eloop.[ch], wpa_enc.[ch], driver.h, driver_wifi.c
>
>     4. Packaging/Build:    17 files,  ~600 lines changed
>        Makefile, wpa.xml, svc-wpa, pkgdefs.
>
>     5. GLDv3 Userland:      7 files,   ~600 lines changed
>        libwladm.[ch], mapfile-vers, Makefile.com, secobj.c,
>        libdladm.h, dladm.c
>
>     6. GLDv3 Kernel:        2 files,   ~10  lines changed
>        dld_drv.c, dld.h
>
> In the webrev, each file has been placed into one of the above areas.
> My proposed assignments are:
>
>     Darren J Moffat and Cecilia Hu:             1. WPA Protocol
>     Sagun Shakya:                               2. DLPI related
>     David Chieu:                                3. Misc
>     David Bustos or a team member of SMF team:  4. Packaging/Build, and
>                                                    libwladm.c (smf)
>     Peter Memishian, Eric Cheng, Cathy Zhou:    5. GLDv3 Userland
>     Peter Memishian:                            6. GLDv3 Kernel
>
> *Thanks* for your assistance, and let us know if you have questions.
> Have fun!  :-)
>
> -----
>
> [1] To provide more context when reviewing other kernel files, the
> net80211, ath, mac-wifi plugin files have been left in webrev/cscope.
>
> [2] In particular, there are some small changes between 2006/046 and
> the provided materials; we will return to the ARC after code review.
>


Reply via email to