From 78d82c8c59b960040416b7ec2ad27b20ffffdd45 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 3 Feb 2001 16:29:10 +0000 Subject: [PATCH] Use LIST_FOREACH() to traverse ifp->if_multiaddrs list, instead of implementation details. Created with: /usr/sbin/sed Reviewed with: /sbin/md5 --- sys/dev/dc/if_dc.c | 12 ++++-------- sys/dev/fxp/if_fxp.c | 3 +-- sys/dev/lnc/if_lnc.c | 3 +-- sys/dev/ray/if_ray.c | 6 ++---- sys/dev/sf/if_sf.c | 3 +-- sys/dev/sk/if_sk.c | 3 +-- sys/dev/snc/dp83932.c | 3 +-- sys/dev/ti/if_ti.c | 3 +-- sys/dev/usb/if_aue.c | 3 +-- sys/dev/usb/if_cue.c | 3 +-- sys/dev/usb/if_kue.c | 3 +-- sys/dev/vr/if_vr.c | 3 +-- sys/dev/wi/if_wi.c | 3 +-- sys/pci/if_dc.c | 12 ++++-------- sys/pci/if_fxp.c | 3 +-- sys/pci/if_pcn.c | 3 +-- sys/pci/if_rl.c | 3 +-- sys/pci/if_sf.c | 3 +-- sys/pci/if_sis.c | 6 ++---- sys/pci/if_sk.c | 3 +-- sys/pci/if_ste.c | 3 +-- sys/pci/if_ti.c | 3 +-- sys/pci/if_tl.c | 3 +-- sys/pci/if_vr.c | 3 +-- sys/pci/if_wb.c | 3 +-- sys/pci/if_xl.c | 6 ++---- 26 files changed, 35 insertions(+), 70 deletions(-) diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index 0745fded7722..f66e65d91023 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -1051,8 +1051,7 @@ void dc_setfilt_21143(sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_le(sc, @@ -1123,8 +1122,7 @@ void dc_setfilt_admtek(sc) return; /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -1192,8 +1190,7 @@ void dc_setfilt_asix(sc) return; /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -1247,8 +1244,7 @@ void dc_setfilt_xircom(sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_le(sc, diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index b472e5b9a202..0149221d60e1 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -1907,8 +1907,7 @@ fxp_mc_setup(sc) nmcasts = 0; if (!sc->all_mcasts) { - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (nmcasts >= MAXMCADDR) { diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c index e402799adcbf..f41c4ffbf986 100644 --- a/sys/dev/lnc/if_lnc.c +++ b/sys/dev/lnc/if_lnc.c @@ -245,8 +245,7 @@ lnc_setladrf(struct lnc_softc *sc) */ bzero(sc->init_block->ladrf, MULTICAST_FILTER_LEN); - for (ifma = ifp->if_multiaddrs.lh_first; ifma; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; diff --git a/sys/dev/ray/if_ray.c b/sys/dev/ray/if_ray.c index f00d7406eb79..2563daf8298a 100644 --- a/sys/dev/ray/if_ray.c +++ b/sys/dev/ray/if_ray.c @@ -2421,8 +2421,7 @@ ray_mcast(struct ray_softc *sc, struct ray_comq_entry *com) * The multicast list is only 16 items long so use promiscuous * mode and don't bother updating the multicast list. */ - for (ifma = ifp->if_multiaddrs.lh_first, count = 0; ifma != NULL; - ifma = ifma->ifma_link.le_next, count++) + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) if (count == 0) { ray_com_runq_done(sc); return; @@ -2440,8 +2439,7 @@ ray_mcast(struct ray_softc *sc, struct ray_comq_entry *com) SRAM_WRITE_FIELD_1(sc, com->c_ccs, ray_cmd_update_mcast, c_nmcast, count); bufp = RAY_HOST_TO_ECF_BASE; - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { SRAM_WRITE_REGION( sc, bufp, diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index b7f6d36d4e08..ff01bf0c5a41 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -449,8 +449,7 @@ static void sf_setmulti(sc) } else { i = 1; /* First find the tail of the list. */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_link.le_next == NULL) break; } diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index f09df99bd60b..a0dc45acf1d4 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -558,8 +558,7 @@ static void sk_setmulti(sc_if) } else { i = 1; /* First find the tail of the list. */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_link.le_next == NULL) break; } diff --git a/sys/dev/snc/dp83932.c b/sys/dev/snc/dp83932.c index 9ccab41dc9a7..496cc3a5f6d5 100644 --- a/sys/dev/snc/dp83932.c +++ b/sys/dev/snc/dp83932.c @@ -678,8 +678,7 @@ camprogram(sc) ifp->if_flags &= ~IFF_ALLMULTI; /* Loop through multicast addresses */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (mcount == MAXCAM) { diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 9b29e094bd6d..cb28d01c4e10 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -1081,8 +1081,7 @@ static void ti_setmulti(sc) } /* Now program new ones. */ - for (ifma = ifp->if_multiaddrs.lh_first; - ifma != NULL; ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT); diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 980457391768..01f9d2d8d61a 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -538,8 +538,7 @@ Static void aue_setmulti(sc) csr_write_1(sc, AUE_MAR0 + i, 0); /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = aue_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index 6b71b48e462d..9a0364616ac0 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -382,8 +382,7 @@ Static void cue_setmulti(sc) sc->cue_mctab[i] = 0; /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = cue_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 4d89b7072010..d907c0126a62 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -336,8 +336,7 @@ Static void kue_setmulti(sc) sc->kue_rxfilt &= ~KUE_RXFILT_ALLMULTI; - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; /* diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index 9e5ee21d01cd..8ea9944ec5dc 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -530,8 +530,7 @@ static void vr_setmulti(sc) CSR_WRITE_4(sc, VR_MAR1, 0); /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = vr_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 37f4f1b444d5..7fad2dea3588 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -1035,8 +1035,7 @@ static void wi_setmulti(sc) return; } - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (i < 16) { diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c index 0745fded7722..f66e65d91023 100644 --- a/sys/pci/if_dc.c +++ b/sys/pci/if_dc.c @@ -1051,8 +1051,7 @@ void dc_setfilt_21143(sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_le(sc, @@ -1123,8 +1122,7 @@ void dc_setfilt_admtek(sc) return; /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -1192,8 +1190,7 @@ void dc_setfilt_asix(sc) return; /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -1247,8 +1244,7 @@ void dc_setfilt_xircom(sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = dc_crc_le(sc, diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c index b472e5b9a202..0149221d60e1 100644 --- a/sys/pci/if_fxp.c +++ b/sys/pci/if_fxp.c @@ -1907,8 +1907,7 @@ fxp_mc_setup(sc) nmcasts = 0; if (!sc->all_mcasts) { - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (nmcasts >= MAXMCADDR) { diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c index af893fd4fa4b..0934bbfe6793 100644 --- a/sys/pci/if_pcn.c +++ b/sys/pci/if_pcn.c @@ -343,8 +343,7 @@ static void pcn_setmulti(sc) pcn_csr_write(sc, PCN_CSR_MAR0 + i, 0); /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = pcn_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index 5463f078e13d..d3a51aca9b81 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -719,8 +719,7 @@ static void rl_setmulti(sc) CSR_WRITE_4(sc, RL_MAR4, 0); /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = rl_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c index b7f6d36d4e08..ff01bf0c5a41 100644 --- a/sys/pci/if_sf.c +++ b/sys/pci/if_sf.c @@ -449,8 +449,7 @@ static void sf_setmulti(sc) } else { i = 1; /* First find the tail of the list. */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_link.le_next == NULL) break; } diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c index d271e47ce861..cbbe36d85531 100644 --- a/sys/pci/if_sis.c +++ b/sys/pci/if_sis.c @@ -521,8 +521,7 @@ static void sis_setmulti_ns(sc) CSR_WRITE_4(sc, SIS_RXFILT_DATA, 0); } - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = sis_crc(sc, LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); @@ -564,8 +563,7 @@ static void sis_setmulti_sis(sc) } /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = sis_crc(sc, LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c index f09df99bd60b..a0dc45acf1d4 100644 --- a/sys/pci/if_sk.c +++ b/sys/pci/if_sk.c @@ -558,8 +558,7 @@ static void sk_setmulti(sc_if) } else { i = 1; /* First find the tail of the list. */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_link.le_next == NULL) break; } diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c index 017ac062d789..ddaa2c4aa447 100644 --- a/sys/pci/if_ste.c +++ b/sys/pci/if_ste.c @@ -588,8 +588,7 @@ static void ste_setmulti(sc) CSR_WRITE_4(sc, STE_MAR1, 0); /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ste_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index 9b29e094bd6d..cb28d01c4e10 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -1081,8 +1081,7 @@ static void ti_setmulti(sc) } /* Now program new ones. */ - for (ifma = ifp->if_multiaddrs.lh_first; - ifma != NULL; ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT); diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c index ccc70692f283..b4c576bcb9aa 100644 --- a/sys/pci/if_tl.c +++ b/sys/pci/if_tl.c @@ -953,8 +953,7 @@ static void tl_setmulti(sc) } else { i = 1; /* First find the tail of the list. */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_link.le_next == NULL) break; } diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c index 9e5ee21d01cd..8ea9944ec5dc 100644 --- a/sys/pci/if_vr.c +++ b/sys/pci/if_vr.c @@ -530,8 +530,7 @@ static void vr_setmulti(sc) CSR_WRITE_4(sc, VR_MAR1, 0); /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = vr_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c index fecc20d8cee1..7f93cb01990a 100644 --- a/sys/pci/if_wb.c +++ b/sys/pci/if_wb.c @@ -641,8 +641,7 @@ static void wb_setmulti(sc) CSR_WRITE_4(sc, WB_MAR1, 0); /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = wb_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index c6abf6f51e1f..1fc62b3a13f4 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -808,8 +808,7 @@ static void xl_setmulti(sc) return; } - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) mcnt++; if (mcnt) @@ -852,8 +851,7 @@ static void xl_setmulti_hash(sc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH|i); /* now program new ones */ - for (ifma = ifp->if_multiaddrs.lh_first; ifma != NULL; - ifma = ifma->ifma_link.le_next) { + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = xl_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));