[illumos-Developer] update on iprb webrev

Garrett D'Amore garrett at nexenta.com
Thu Dec 2 21:55:45 PST 2010


Well, NICDRV found one bug, and a one bug was found by a reviewer.
Here's the updated diff relative to the original webrev.  I'm hoping to
integrate this code tomorrow.

(The bug was a hang when trying to delete a multicast address when there
was more than one multicast address in the list, I wasn't advancing to
the next node in the list.  Doh!)


diff -r 67f6c838a056 -r 3d0c886d5186 usr/src/uts/common/io/iprb/iprb.c
--- a/usr/src/uts/common/io/iprb/iprb.c Wed Dec 01 12:27:18 2010 -0800
+++ b/usr/src/uts/common/io/iprb/iprb.c Thu Dec 02 21:51:47 2010 -0800
@@ -393,7 +393,7 @@
        macp->m_min_sdu = 0;
        macp->m_max_sdu = ETHERMTU;
        macp->m_margin = VLAN_TAGSZ;
-       if (mac_register(macp, &ip->mach) == DDI_FAILURE) {
+       if (mac_register(macp, &ip->mach) != 0) {
                iprb_error(ip, "unable to register mac with framework");
                mac_free(macp);
                iprb_destroy(ip);
@@ -1245,8 +1245,9 @@
 int
 iprb_m_multicst(void *arg, boolean_t add, const uint8_t *macaddr)
 {
-       iprb_t *ip = arg;
-       iprb_mcast_t *mc;
+       iprb_t          *ip = arg;
+       list_t          *l = &ip->mcast;
+       iprb_mcast_t    *mc;
 
        if (add) {
                mc = kmem_alloc(sizeof (*mc), KM_NOSLEEP);
@@ -1255,15 +1256,14 @@
                }
                bcopy(macaddr, mc->addr, 6);
                mutex_enter(&ip->culock);
-               list_insert_head(&ip->mcast, mc);
+               list_insert_head(l, mc);
                ip->nmcast++;
                if (ip->running && !ip->suspended)
                        (void) iprb_configure(ip);
                mutex_exit(&ip->culock);
        } else {
                mutex_enter(&ip->culock);
-               mc = list_head(&ip->mcast);
-               while (mc != NULL) {
+               for (mc = list_head(l); mc != NULL; mc = list_next(l,
mc)) {
                        if (bcmp(macaddr, mc->addr, 6) == 0) {
                                list_remove(&ip->mcast, mc);
                                ip->nmcast--;




More information about the Developer mailing list