Date: Wed, 3 Aug 2011 10:52:13 GMT From: Takuya ASADA <syuu@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 197123 for review Message-ID: <201108031052.p73AqDvq026650@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@197123?ac=10 Change 197123 by syuu@kikurage on 2011/08/03 10:51:23 mq_bpf support for ixgbe Affected files ... .. //depot/projects/soc2011/mq_bpf/src/sys/dev/ixgbe/ixgbe.c#2 edit .. //depot/projects/soc2011/mq_bpf/src/sys/dev/ixgbe/ixgbe.h#2 edit Differences ... ==== //depot/projects/soc2011/mq_bpf/src/sys/dev/ixgbe/ixgbe.c#2 (text+ko) ==== @@ -195,6 +195,12 @@ static void ixgbe_reinit_fdir(void *, int); #endif +static int ixgbe_get_rxqueue_len(struct ifnet *); +static int ixgbe_get_txqueue_len(struct ifnet *); +static int ixgbe_get_rxqueue_affinity(struct ifnet *, int); +static int ixgbe_get_txqueue_affinity(struct ifnet *, int); + + /********************************************************************* * FreeBSD Device Interface Entry Points *********************************************************************/ @@ -712,6 +718,10 @@ IFQ_DRV_PREPEND(&ifp->if_snd, m_head); break; } + + m_head->m_pkthdr.rxqueue = (uint32_t)-1; + m_head->m_pkthdr.txqueue = txr->me; + /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, m_head); @@ -806,6 +816,10 @@ } enqueued++; drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags); + + next->m_pkthdr.rxqueue = (uint32_t)-1; + next->m_pkthdr.txqueue = txr->me; + /* Send a copy of the frame to the BPF listener */ ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -2399,6 +2413,11 @@ ifp->if_transmit = ixgbe_mq_start; ifp->if_qflush = ixgbe_qflush; #endif + ifp->if_get_rxqueue_len = ixgbe_get_rxqueue_len; + ifp->if_get_txqueue_len = ixgbe_get_txqueue_len; + ifp->if_get_rxqueue_affinity = ixgbe_get_rxqueue_affinity; + ifp->if_get_txqueue_affinity = ixgbe_get_txqueue_affinity; + ifp->if_snd.ifq_maxlen = adapter->num_tx_desc - 2; ether_ifattach(ifp, adapter->hw.mac.addr); @@ -2414,6 +2433,7 @@ ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4 | IFCAP_VLAN_HWCSUM; ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; ifp->if_capabilities |= IFCAP_JUMBO_MTU; + ifp->if_capabilities |= IFCAP_MULTIQUEUE; ifp->if_capenable = ifp->if_capabilities; /* Don't enable LRO by default */ @@ -4123,6 +4143,8 @@ struct mbuf *sendmp, *mh, *mp; u32 rsc, ptype; u16 hlen, plen, hdr, vtag; + u32 rss; + u8 rsstype; bool eop; /* Sync the ring. */ @@ -4150,6 +4172,9 @@ ptype = le32toh(cur->wb.lower.lo_dword.data) & IXGBE_RXDADV_PKTTYPE_MASK; hdr = le16toh(cur->wb.lower.lo_dword.hs_rss.hdr_info); + rss = le32toh(cur->wb.lower.hi_dword.rss); + rsstype = le32toh(cur->wb.lower.lo_dword.data) & + IXGBE_RXDADV_RSSTYPE_MASK; vtag = le16toh(cur->wb.upper.vlan); eop = ((staterr & IXGBE_RXD_STAT_EOP) != 0); @@ -4304,9 +4329,29 @@ if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) ixgbe_rx_checksum(staterr, sendmp, ptype); #if __FreeBSD_version >= 800000 - sendmp->m_pkthdr.flowid = que->msix; + sendmp->m_pkthdr.flowid = rss; sendmp->m_flags |= M_FLOWID; + switch (rsstype) { + case IXGBE_HASH_TCP_IPV4: + M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_TCP_IPV4); + break; + case IXGBE_HASH_IPV4: + case IXGBE_HASH_UDP_IPV4: + M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_IPV4); + break; + case IXGBE_HASH_TCP_IPV6: + M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_TCP_IPV6); + break; + case IXGBE_HASH_IPV6: + case IXGBE_HASH_UDP_IPV6: + M_HASHTYPE_SET(sendmp, M_HASHTYPE_RSS_IPV6); + break; + default: + M_HASHTYPE_SET(sendmp, M_HASHTYPE_NONE); + } #endif + sendmp->m_pkthdr.rxqueue = que->msix; + sendmp->m_pkthdr.txqueue = (uint32_t)-1; } next_desc: bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, @@ -5365,3 +5410,29 @@ return (error); } + +static int +ixgbe_get_rxqueue_len(struct ifnet *ifp) +{ + struct adapter *adapter = ifp->if_softc; + return (adapter->num_queues); +} + +static int +ixgbe_get_txqueue_len(struct ifnet *ifp) +{ + struct adapter *adapter = ifp->if_softc; + return (adapter->num_queues); +} + +static int +ixgbe_get_rxqueue_affinity(struct ifnet *ifp, int queid) +{ + return (queid); +} + +static int +ixgbe_get_txqueue_affinity(struct ifnet *ifp, int queid) +{ + return (queid); +} ==== //depot/projects/soc2011/mq_bpf/src/sys/dev/ixgbe/ixgbe.h#2 (text+ko) ==== @@ -366,10 +366,12 @@ struct ifmedia media; struct callout timer; + struct callout timer2; int msix; int if_flags; struct mtx core_mtx; + struct mtx core_mtx2; eventhandler_tag vlan_attach; eventhandler_tag vlan_detach; @@ -517,4 +519,12 @@ rxr->next_to_refresh - 1); } +#define IXGBE_HASH_NONE 0x0 +#define IXGBE_HASH_TCP_IPV4 0x1 +#define IXGBE_HASH_IPV4 0x2 +#define IXGBE_HASH_TCP_IPV6 0x3 +#define IXGBE_HASH_IPV6 0x5 +#define IXGBE_HASH_UDP_IPV4 0x7 +#define IXGBE_HASH_UDP_IPV6 0x8 + #endif /* _IXGBE_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108031052.p73AqDvq026650>