cxgbe(4): Report IFCAP_TXRTLMT to kernels built with RATELIMIT if the

firmware has provisioned resources for this feature.

Sponsored by:	Chelsio Communications
This commit is contained in:
Navdeep Parhar 2018-05-24 10:55:26 +00:00
parent 92849603d0
commit 475d42db4a

View File

@ -1507,6 +1507,10 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi)
#ifdef DEV_NETMAP
if (vi->nnmrxq != 0)
ifp->if_capabilities |= IFCAP_NETMAP;
#endif
#ifdef RATELIMIT
if (is_ethoffload(vi->pi->adapter) && vi->nofldtxq != 0)
ifp->if_capabilities |= IFCAP_TXRTLMT;
#endif
ifp->if_capenable = T4_CAP_ENABLE;
ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO |
@ -1526,10 +1530,22 @@ cxgbe_vi_attach(device_t dev, struct vi_info *vi)
#endif
sb = sbuf_new_auto();
sbuf_printf(sb, "%d txq, %d rxq (NIC)", vi->ntxq, vi->nrxq);
#if defined(TCP_OFFLOAD) || defined(RATELIMIT)
switch (ifp->if_capabilities & (IFCAP_TOE | IFCAP_TXRTLMT)) {
case IFCAP_TOE:
sbuf_printf(sb, "; %d txq (TOE)", vi->nofldtxq);
break;
case IFCAP_TOE | IFCAP_TXRTLMT:
sbuf_printf(sb, "; %d txq (TOE/ETHOFLD)", vi->nofldtxq);
break;
case IFCAP_TXRTLMT:
sbuf_printf(sb, "; %d txq (ETHOFLD)", vi->nofldtxq);
break;
}
#endif
#ifdef TCP_OFFLOAD
if (ifp->if_capabilities & IFCAP_TOE)
sbuf_printf(sb, "; %d txq, %d rxq (TOE)",
vi->nofldtxq, vi->nofldrxq);
sbuf_printf(sb, ", %d rxq (TOE)", vi->nofldrxq);
#endif
#ifdef DEV_NETMAP
if (ifp->if_capabilities & IFCAP_NETMAP)
@ -1821,6 +1837,10 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data)
ifp->if_capenable ^= IFCAP_VLAN_HWTSO;
if (mask & IFCAP_VLAN_HWCSUM)
ifp->if_capenable ^= IFCAP_VLAN_HWCSUM;
#ifdef RATELIMIT
if (mask & IFCAP_TXRTLMT)
ifp->if_capenable ^= IFCAP_TXRTLMT;
#endif
#ifdef VLAN_CAPABILITIES
VLAN_CAPABILITIES(ifp);