Date: Sat, 14 May 2011 02:09:37 GMT From: Takuya ASADA <syuu@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 193100 for review Message-ID: <201105140209.p4E29bDL008769@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@193100?ac=10 Change 193100 by syuu@kikurage on 2011/05/14 02:08:48 revert rwlock, remove KASSERT, temporarily commented out if_rcvq_affinity Affected files ... .. //depot/projects/soc2011/multiqueue_bpf/sys/dev/e1000/if_igb.c#3 edit .. //depot/projects/soc2011/multiqueue_bpf/sys/net/bpf.c#4 edit .. //depot/projects/soc2011/multiqueue_bpf/sys/net/bpf.h#4 edit .. //depot/projects/soc2011/multiqueue_bpf/sys/net/bpfdesc.h#4 edit .. //depot/projects/soc2011/multiqueue_bpf/sys/net/if_var.h#3 edit Differences ... ==== //depot/projects/soc2011/multiqueue_bpf/sys/dev/e1000/if_igb.c#3 (text+ko) ==== @@ -2694,7 +2694,9 @@ igb_setup_interface(device_t dev, struct adapter *adapter) { struct ifnet *ifp; +#if 0 int i; +#endif INIT_DEBUGOUT("igb_setup_interface: begin"); @@ -2751,9 +2753,11 @@ ** enable this and get full hardware tag filtering. */ ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; +#if 0 ifp->if_rcvq_affinity.ra_len = adapter->num_rx_desc; for (i = 0; i < adapter->num_rx_desc; i++) ifp->if_rcvq_affinity.ra_q[i] = i; +#endif /* * Specify the media types supported by this adapter and register @@ -4443,7 +4447,8 @@ rxr->fmp->m_flags |= M_FLOWID; #endif rxr->fmp->m_pkthdr.rcvq = que->msix; - KASSERT(que->msix == PCPU_GET(cpuid), ("que->msix != cpuid")); + if (que->msix != PCPU_GET(cpuid)) + printf("igb msix:%d cpuid:%d\n", que->msix, PCPU_GET(cpuid)); sendmp = rxr->fmp; /* Make sure to set M_PKTHDR. */ sendmp->m_flags |= M_PKTHDR; ==== //depot/projects/soc2011/multiqueue_bpf/sys/net/bpf.c#4 (text+ko) ==== @@ -574,12 +574,12 @@ * Finally, point the driver's bpf cookie at the interface so * it will divert packets to bpf. */ - BPFIF_WLOCK(bp); + BPFIF_LOCK(bp); d->bd_bif = bp; LIST_INSERT_HEAD(&bp->bif_dlist, d, bd_next); bpf_bpfd_cnt++; - BPFIF_WUNLOCK(bp); + BPFIF_UNLOCK(bp); EVENTHANDLER_INVOKE(bpf_track, bp->bif_ifp, bp->bif_dlt, 1); } @@ -595,7 +595,7 @@ struct ifnet *ifp; bp = d->bd_bif; - BPFIF_WLOCK(bp); + BPFIF_LOCK(bp); BPFD_LOCK(d); ifp = d->bd_bif->bif_ifp; @@ -607,7 +607,7 @@ bpf_bpfd_cnt--; d->bd_bif = NULL; BPFD_UNLOCK(d); - BPFIF_WUNLOCK(bp); + BPFIF_UNLOCK(bp); EVENTHANDLER_INVOKE(bpf_track, ifp, bp->bif_dlt, 0); @@ -1512,18 +1512,26 @@ error = bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr); break; case BIOCQLEN: +#if 0 if (d->bd_bif == NULL) error = EINVAL; else *(int *)addr = d->bd_bif->bif_ifp->if_rcvq_affinity.ra_len; +#else + error = EINVAL; +#endif break; case BIOCGETQAFFINITY: +#if 0 if (d->bd_bif == NULL) error = EINVAL; else { int index = *(int *)addr; *(u_long *)addr = d->bd_bif->bif_ifp->if_rcvq_affinity.ra_q[index]; } +#else + error = EINVAL; +#endif break; case BIOCSETQMASK: d->bd_qmask = *(u_int *)addr; @@ -1840,7 +1848,7 @@ int gottime; gottime = BPF_TSTAMP_NONE; - BPFIF_RLOCK(bp); + BPFIF_LOCK(bp); LIST_FOREACH(d, &bp->bif_dlist, bd_next) { BPFD_LOCK(d); ++d->bd_rcount; @@ -1869,7 +1877,7 @@ } BPFD_UNLOCK(d); } - BPFIF_RUNLOCK(bp); + BPFIF_UNLOCK(bp); } #define BPF_CHECK_DIRECTION(d, r, i) \ @@ -1899,7 +1907,7 @@ pktlen = m_length(m, NULL); gottime = BPF_TSTAMP_NONE; - BPFIF_RLOCK(bp); + BPFIF_LOCK(bp); LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; @@ -1927,7 +1935,7 @@ } BPFD_UNLOCK(d); } - BPFIF_RUNLOCK(bp); + BPFIF_UNLOCK(bp); } /* @@ -1961,7 +1969,7 @@ pktlen += dlen; gottime = BPF_TSTAMP_NONE; - BPFIF_RLOCK(bp); + BPFIF_LOCK(bp); LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; @@ -1982,7 +1990,7 @@ } BPFD_UNLOCK(d); } - BPFIF_RUNLOCK(bp); + BPFIF_UNLOCK(bp); } #undef BPF_CHECK_DIRECTION @@ -2253,7 +2261,7 @@ LIST_INIT(&bp->bif_dlist); bp->bif_ifp = ifp; bp->bif_dlt = dlt; - rw_init(&bp->bif_lock, "bpf interface lock"); + mtx_init(&bp->bif_mtx, "bpf interface lock", NULL, MTX_DEF); KASSERT(*driverp == NULL, ("bpfattach2: driverp already initialized")); *driverp = bp; @@ -2303,7 +2311,7 @@ BPFD_UNLOCK(d); } - rw_destroy(&bp->bif_lock); + mtx_destroy(&bp->bif_mtx); free(bp, M_BPF); } @@ -2404,7 +2412,7 @@ mtx_lock(&bpf_mtx); LIST_FOREACH(bp, &bpf_iflist, bif_next) { - BPFIF_RLOCK(bp); + BPFIF_LOCK(bp); LIST_FOREACH(bd, &bp->bif_dlist, bd_next) { BPFD_LOCK(bd); bd->bd_rcount = 0; @@ -2415,7 +2423,7 @@ bd->bd_zcopy = 0; BPFD_UNLOCK(bd); } - BPFIF_RUNLOCK(bp); + BPFIF_UNLOCK(bp); } mtx_unlock(&bpf_mtx); } @@ -2496,14 +2504,14 @@ } index = 0; LIST_FOREACH(bp, &bpf_iflist, bif_next) { - BPFIF_RLOCK(bp); + BPFIF_LOCK(bp); LIST_FOREACH(bd, &bp->bif_dlist, bd_next) { xbd = &xbdbuf[index++]; BPFD_LOCK(bd); bpfstats_fill_xbpf(xbd, bd); BPFD_UNLOCK(bd); } - BPFIF_RUNLOCK(bp); + BPFIF_UNLOCK(bp); } mtx_unlock(&bpf_mtx); error = SYSCTL_OUT(req, xbdbuf, index * sizeof(*xbd)); ==== //depot/projects/soc2011/multiqueue_bpf/sys/net/bpf.h#4 (text+ko) ==== @@ -40,8 +40,6 @@ #ifndef _NET_BPF_H_ #define _NET_BPF_H_ -#include <sys/rwlock.h> - /* BSD style release date */ #define BPF_RELEASE 199606 @@ -1106,7 +1104,7 @@ u_int bif_dlt; /* link layer type */ u_int bif_hdrlen; /* length of link header */ struct ifnet *bif_ifp; /* corresponding interface */ - struct rwlock bif_lock; /* rwlock for interface */ + struct mtx bif_mtx; /* mutex for interface */ }; void bpf_bufheld(struct bpf_d *d); ==== //depot/projects/soc2011/multiqueue_bpf/sys/net/bpfdesc.h#4 (text+ko) ==== @@ -145,10 +145,7 @@ u_int64_t bd_spare[4]; }; -#define BPFIF_RLOCK(bif) rw_rlock(&(bif)->bif_lock) -#define BPFIF_RUNLOCK(bif) rw_runlock(&(bif)->bif_lock) - -#define BPFIF_WLOCK(bif) rw_wlock(&(bif)->bif_lock) -#define BPFIF_WUNLOCK(bif) rw_wunlock(&(bif)->bif_lock) +#define BPFIF_LOCK(bif) mtx_lock(&(bif)->bif_mtx) +#define BPFIF_UNLOCK(bif) mtx_unlock(&(bif)->bif_mtx) #endif ==== //depot/projects/soc2011/multiqueue_bpf/sys/net/if_var.h#3 (text+ko) ==== @@ -111,11 +111,13 @@ struct mtx ifq_mtx; }; +#if 0 /* XXX: should support large number of queues */ struct rcvq_affinity { int ra_len; u_long ra_q[32]; }; +#endif /* * Structure defining a network interface. @@ -203,7 +205,9 @@ void *if_lagg; /* lagg glue */ u_char if_alloctype; /* if_type at time of allocation */ +#if 0 struct rcvq_affinity if_rcvq_affinity; +#endif /* * Spare fields are added so that we can modify sensitive data
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105140209.p4E29bDL008769>
