Date: Fri, 13 May 2011 01:55:36 GMT From: Takuya ASADA <syuu@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 193033 for review Message-ID: <201105130155.p4D1tad4018295@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@193033?ac=10 Change 193033 by syuu@maitake2 on 2011/05/13 01:54:40 Experimental implementation of multiqueue bpf. Not tested yet. Affected files ... .. //depot/projects/soc2011/multiqueue_bpf/sys/dev/e1000/if_igb.c#2 edit .. //depot/projects/soc2011/multiqueue_bpf/sys/net/bpf.c#2 edit .. //depot/projects/soc2011/multiqueue_bpf/sys/net/bpf.h#2 edit .. //depot/projects/soc2011/multiqueue_bpf/sys/net/bpfdesc.h#2 edit .. //depot/projects/soc2011/multiqueue_bpf/sys/net/if_var.h#2 edit .. //depot/projects/soc2011/multiqueue_bpf/sys/sys/mbuf.h#2 edit Differences ... ==== //depot/projects/soc2011/multiqueue_bpf/sys/dev/e1000/if_igb.c#2 (text+ko) ==== @@ -2694,6 +2694,7 @@ igb_setup_interface(device_t dev, struct adapter *adapter) { struct ifnet *ifp; + int i; INIT_DEBUGOUT("igb_setup_interface: begin"); @@ -2750,7 +2751,10 @@ ** enable this and get full hardware tag filtering. */ ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; - + 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; + /* * Specify the media types supported by this adapter and register * callbacks to update media and link information @@ -4438,6 +4442,8 @@ rxr->fmp->m_pkthdr.flowid = que->msix; rxr->fmp->m_flags |= M_FLOWID; #endif + rxr->fmp->m_pkthdr.rcvq = que->msix; + KASSERT(que->msix == PCPU_GET(cpuid), ("que->msix != cpuid")); sendmp = rxr->fmp; /* Make sure to set M_PKTHDR. */ sendmp->m_flags |= M_PKTHDR; ==== //depot/projects/soc2011/multiqueue_bpf/sys/net/bpf.c#2 (text+ko) ==== @@ -690,6 +690,7 @@ d->bd_sig = SIGIO; d->bd_direction = BPF_D_INOUT; d->bd_pid = td->td_proc->p_pid; + d->bd_qmask = (u_int)-1; #ifdef MAC mac_bpfdesc_init(d); mac_bpfdesc_create(td->td_ucred, d); @@ -1510,6 +1511,26 @@ case BIOCROTZBUF: error = bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr); break; + case BIOCQLEN: + if (d->bd_bif == NULL) + error = EINVAL; + else + *(int *)addr = d->bd_bif->bif_ifp->if_rcvq_affinity.ra_len; + break; + case BIOCGETQAFFINITY: + 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]; + } + break; + case BIOCSETQMASK: + d->bd_qmask = *(u_int *)addr; + break; + case BIOCGETQMASK: + *(u_int *)addr = d->bd_qmask; + break; } CURVNET_RESTORE(); return (error); @@ -1882,6 +1903,8 @@ LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; + if (!(d->bd_qmask & m->m_pkthdr.rcvq)) + continue; BPFD_LOCK(d); ++d->bd_rcount; #ifdef BPF_JITTER @@ -1942,6 +1965,8 @@ LIST_FOREACH(d, &bp->bif_dlist, bd_next) { if (BPF_CHECK_DIRECTION(d, m->m_pkthdr.rcvif, bp->bif_ifp)) continue; + if (!(d->bd_qmask & m->m_pkthdr.rcvq)) + continue; BPFD_LOCK(d); ++d->bd_rcount; slen = bpf_filter(d->bd_rfilter, (u_char *)&mb, pktlen, 0); ==== //depot/projects/soc2011/multiqueue_bpf/sys/net/bpf.h#2 (text+ko) ==== @@ -147,6 +147,11 @@ #define BIOCSETFNR _IOW('B', 130, struct bpf_program) #define BIOCGTSTAMP _IOR('B', 131, u_int) #define BIOCSTSTAMP _IOW('B', 132, u_int) +#define BIOCQLEN _IOW('B', 133, u_long) +#define BIOCGETQLEN _IOR('B', 134, int) +#define BIOCGETQAFFINITY _IOWR('B', 135, u_long) +#define BIOCSETQMASK _IOW('B', 136, u_int) +#define BIOCGETQMASK _IOR('B', 137, u_int) /* Obsolete */ #define BIOCGSEESENT BIOCGDIRECTION ==== //depot/projects/soc2011/multiqueue_bpf/sys/net/bpfdesc.h#2 (text+ko) ==== @@ -99,6 +99,7 @@ u_int64_t bd_wdcount; /* number of packets dropped during a write */ u_int64_t bd_zcopy; /* number of zero copy operations */ u_char bd_compat32; /* 32-bit stream on LP64 system */ + u_int bd_qmask; /* XXX: should support large number of queues */ }; /* Values for bd_state */ ==== //depot/projects/soc2011/multiqueue_bpf/sys/net/if_var.h#2 (text+ko) ==== @@ -111,6 +111,12 @@ struct mtx ifq_mtx; }; +/* XXX: should support large number of queues */ +struct rcvq_affinity { + int ra_len; + u_long ra_q[32]; +}; + /* * Structure defining a network interface. * @@ -197,6 +203,8 @@ void *if_lagg; /* lagg glue */ u_char if_alloctype; /* if_type at time of allocation */ + struct rcvq_affinity if_rcvq_affinity; + /* * Spare fields are added so that we can modify sensitive data * structures without changing the kernel binary interface, and must ==== //depot/projects/soc2011/multiqueue_bpf/sys/sys/mbuf.h#2 (text+ko) ==== @@ -118,6 +118,7 @@ uint32_t flowid; /* packet's 4-tuple system * flow identifier */ + int rcvq; /* variables for hardware checksum */ int csum_flags; /* flags regarding checksum */ int csum_data; /* data field used by csum routines */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105130155.p4D1tad4018295>