Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ixgbe/if_fdir.c
Show All 31 Lines | |||||
******************************************************************************/ | ******************************************************************************/ | ||||
/*$FreeBSD$*/ | /*$FreeBSD$*/ | ||||
#include "ixgbe.h" | #include "ixgbe.h" | ||||
#ifdef IXGBE_FDIR | #ifdef IXGBE_FDIR | ||||
void | void | ||||
ixgbe_init_fdir(struct adapter *adapter) | ixgbe_init_fdir(struct ixgbe_softc *sc) | ||||
{ | { | ||||
u32 hdrm = 32 << fdir_pballoc; | u32 hdrm = 32 << fdir_pballoc; | ||||
if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) | if (!(sc->feat_en & IXGBE_FEATURE_FDIR)) | ||||
return; | return; | ||||
adapter->hw.mac.ops.setup_rxpba(&adapter->hw, 0, hdrm, | sc->hw.mac.ops.setup_rxpba(&sc->hw, 0, hdrm, | ||||
PBA_STRATEGY_EQUAL); | PBA_STRATEGY_EQUAL); | ||||
ixgbe_init_fdir_signature_82599(&adapter->hw, fdir_pballoc); | ixgbe_init_fdir_signature_82599(&sc->hw, fdir_pballoc); | ||||
} /* ixgbe_init_fdir */ | } /* ixgbe_init_fdir */ | ||||
void | void | ||||
ixgbe_reinit_fdir(void *context) | ixgbe_reinit_fdir(void *context) | ||||
{ | { | ||||
if_ctx_t ctx = context; | if_ctx_t ctx = context; | ||||
struct adapter *adapter = iflib_get_softc(ctx); | struct ixgbe_softc *sc = iflib_get_softc(ctx); | ||||
struct ifnet *ifp = iflib_get_ifp(ctx); | struct ifnet *ifp = iflib_get_ifp(ctx); | ||||
if (!(adapter->feat_en & IXGBE_FEATURE_FDIR)) | if (!(sc->feat_en & IXGBE_FEATURE_FDIR)) | ||||
return; | return; | ||||
if (adapter->fdir_reinit != 1) /* Shouldn't happen */ | if (sc->fdir_reinit != 1) /* Shouldn't happen */ | ||||
return; | return; | ||||
ixgbe_reinit_fdir_tables_82599(&adapter->hw); | ixgbe_reinit_fdir_tables_82599(&sc->hw); | ||||
adapter->fdir_reinit = 0; | sc->fdir_reinit = 0; | ||||
/* re-enable flow director interrupts */ | /* re-enable flow director interrupts */ | ||||
IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); | IXGBE_WRITE_REG(&sc->hw, IXGBE_EIMS, IXGBE_EIMS_FLOW_DIR); | ||||
/* Restart the interface */ | /* Restart the interface */ | ||||
ifp->if_drv_flags |= IFF_DRV_RUNNING; | ifp->if_drv_flags |= IFF_DRV_RUNNING; | ||||
} /* ixgbe_reinit_fdir */ | } /* ixgbe_reinit_fdir */ | ||||
/************************************************************************ | /************************************************************************ | ||||
* ixgbe_atr | * ixgbe_atr | ||||
* | * | ||||
* Parse packet headers so that Flow Director can make | * Parse packet headers so that Flow Director can make | ||||
* a hashed filter table entry allowing traffic flows | * a hashed filter table entry allowing traffic flows | ||||
* to be identified and kept on the same cpu. This | * to be identified and kept on the same cpu. This | ||||
* would be a performance hit, but we only do it at | * would be a performance hit, but we only do it at | ||||
* IXGBE_FDIR_RATE of packets. | * IXGBE_FDIR_RATE of packets. | ||||
************************************************************************/ | ************************************************************************/ | ||||
void | void | ||||
ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) | ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) | ||||
{ | { | ||||
struct adapter *adapter = txr->adapter; | struct ixgbe_softc *sc = txr->sc; | ||||
struct ix_queue *que; | struct ix_queue *que; | ||||
struct ip *ip; | struct ip *ip; | ||||
struct tcphdr *th; | struct tcphdr *th; | ||||
struct udphdr *uh; | struct udphdr *uh; | ||||
struct ether_vlan_header *eh; | struct ether_vlan_header *eh; | ||||
union ixgbe_atr_hash_dword input = {.dword = 0}; | union ixgbe_atr_hash_dword input = {.dword = 0}; | ||||
union ixgbe_atr_hash_dword common = {.dword = 0}; | union ixgbe_atr_hash_dword common = {.dword = 0}; | ||||
int ehdrlen, ip_hlen; | int ehdrlen, ip_hlen; | ||||
Show All 37 Lines | ixgbe_atr(struct tx_ring *txr, struct mbuf *mp) | ||||
input.formatted.vlan_id = htobe16(mp->m_pkthdr.ether_vtag); | input.formatted.vlan_id = htobe16(mp->m_pkthdr.ether_vtag); | ||||
if (mp->m_pkthdr.ether_vtag) | if (mp->m_pkthdr.ether_vtag) | ||||
common.flex_bytes ^= htons(ETHERTYPE_VLAN); | common.flex_bytes ^= htons(ETHERTYPE_VLAN); | ||||
else | else | ||||
common.flex_bytes ^= etype; | common.flex_bytes ^= etype; | ||||
common.ip ^= ip->ip_src.s_addr ^ ip->ip_dst.s_addr; | common.ip ^= ip->ip_src.s_addr ^ ip->ip_dst.s_addr; | ||||
que = &adapter->queues[txr->me]; | que = &sc->queues[txr->me]; | ||||
/* | /* | ||||
* This assumes the Rx queue and Tx | * This assumes the Rx queue and Tx | ||||
* queue are bound to the same CPU | * queue are bound to the same CPU | ||||
*/ | */ | ||||
ixgbe_fdir_add_signature_filter_82599(&adapter->hw, | ixgbe_fdir_add_signature_filter_82599(&sc->hw, | ||||
input, common, que->msix); | input, common, que->msix); | ||||
} /* ixgbe_atr */ | } /* ixgbe_atr */ | ||||
#else | #else | ||||
/* TASK_INIT needs this function defined regardless if it's enabled */ | /* TASK_INIT needs this function defined regardless if it's enabled */ | ||||
void | void | ||||
ixgbe_reinit_fdir(void *context) | ixgbe_reinit_fdir(void *context) | ||||
Show All 11 Lines |