cxgbe(4): Replace T4_PKT_TIMESTAMP with something slightly less hackish.
This commit is contained in:
@@ -349,7 +349,7 @@ enum {
|
|||||||
/* iq flags */
|
/* iq flags */
|
||||||
IQ_ALLOCATED = (1 << 0), /* firmware resources allocated */
|
IQ_ALLOCATED = (1 << 0), /* firmware resources allocated */
|
||||||
IQ_HAS_FL = (1 << 1), /* iq associated with a freelist */
|
IQ_HAS_FL = (1 << 1), /* iq associated with a freelist */
|
||||||
/* 1 << 2 Used to be IQ_INTR */
|
IQ_RX_TIMESTAMP = (1 << 2), /* provide the SGE rx timestamp */
|
||||||
IQ_LRO_ENABLED = (1 << 3), /* iq is an eth rxq with LRO enabled */
|
IQ_LRO_ENABLED = (1 << 3), /* iq is an eth rxq with LRO enabled */
|
||||||
IQ_ADJ_CREDIT = (1 << 4), /* hw is off by 1 credit for this iq */
|
IQ_ADJ_CREDIT = (1 << 4), /* hw is off by 1 credit for this iq */
|
||||||
|
|
||||||
|
|||||||
+14
-1
@@ -1464,7 +1464,8 @@ cxgbe_probe(device_t dev)
|
|||||||
|
|
||||||
#define T4_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \
|
#define T4_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \
|
||||||
IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \
|
IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \
|
||||||
IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6 | IFCAP_HWSTATS)
|
IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6 | IFCAP_HWSTATS | \
|
||||||
|
IFCAP_HWRXTSTMP)
|
||||||
#define T4_CAP_ENABLE (T4_CAP)
|
#define T4_CAP_ENABLE (T4_CAP)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1813,6 +1814,18 @@ cxgbe_ioctl(struct ifnet *ifp, unsigned long cmd, caddr_t data)
|
|||||||
if (mask & IFCAP_TXRTLMT)
|
if (mask & IFCAP_TXRTLMT)
|
||||||
ifp->if_capenable ^= IFCAP_TXRTLMT;
|
ifp->if_capenable ^= IFCAP_TXRTLMT;
|
||||||
#endif
|
#endif
|
||||||
|
if (mask & IFCAP_HWRXTSTMP) {
|
||||||
|
int i;
|
||||||
|
struct sge_rxq *rxq;
|
||||||
|
|
||||||
|
ifp->if_capenable ^= IFCAP_HWRXTSTMP;
|
||||||
|
for_each_rxq(vi, i, rxq) {
|
||||||
|
if (ifp->if_capenable & IFCAP_HWRXTSTMP)
|
||||||
|
rxq->iq.flags |= IQ_RX_TIMESTAMP;
|
||||||
|
else
|
||||||
|
rxq->iq.flags &= ~IQ_RX_TIMESTAMP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef VLAN_CAPABILITIES
|
#ifdef VLAN_CAPABILITIES
|
||||||
VLAN_CAPABILITIES(ifp);
|
VLAN_CAPABILITIES(ifp);
|
||||||
|
|||||||
+26
-16
@@ -1564,6 +1564,17 @@ sort_before_lro(struct lro_ctrl *lro)
|
|||||||
return (lro->lro_mbuf_max != 0);
|
return (lro->lro_mbuf_max != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline uint64_t
|
||||||
|
last_flit_to_ns(struct adapter *sc, uint64_t lf)
|
||||||
|
{
|
||||||
|
uint64_t n = be64toh(lf) & 0xfffffffffffffff; /* 60b, not 64b. */
|
||||||
|
|
||||||
|
if (n > UINT64_MAX / 1000000)
|
||||||
|
return (n / sc->params.vpd.cclk * 1000000);
|
||||||
|
else
|
||||||
|
return (n * 1000000 / sc->params.vpd.cclk);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Deals with interrupts on an iq+fl queue.
|
* Deals with interrupts on an iq+fl queue.
|
||||||
*/
|
*/
|
||||||
@@ -1624,19 +1635,21 @@ service_iq_fl(struct sge_iq *iq, int budget)
|
|||||||
if (__predict_false(m0 == NULL))
|
if (__predict_false(m0 == NULL))
|
||||||
goto out;
|
goto out;
|
||||||
refill = IDXDIFF(fl->hw_cidx, fl_hw_cidx, fl->sidx) > 2;
|
refill = IDXDIFF(fl->hw_cidx, fl_hw_cidx, fl->sidx) > 2;
|
||||||
#ifdef T4_PKT_TIMESTAMP
|
|
||||||
/*
|
if (iq->flags & IQ_RX_TIMESTAMP) {
|
||||||
* 60 bit timestamp for the payload is
|
/*
|
||||||
* *(uint64_t *)m0->m_pktdat. Note that it is
|
* Fill up rcv_tstmp but do not set M_TSTMP.
|
||||||
* in the leading free-space in the mbuf. The
|
* rcv_tstmp is not in the format that the
|
||||||
* kernel can clobber it during a pullup,
|
* kernel expects and we don't want to mislead
|
||||||
* m_copymdata, etc. You need to make sure that
|
* it. For now this is only for custom code
|
||||||
* the mbuf reaches you unmolested if you care
|
* that knows how to interpret cxgbe's stamp.
|
||||||
* about the timestamp.
|
*/
|
||||||
*/
|
m0->m_pkthdr.rcv_tstmp =
|
||||||
*(uint64_t *)m0->m_pktdat =
|
last_flit_to_ns(sc, d->rsp.u.last_flit);
|
||||||
be64toh(ctrl->u.last_flit) & 0xfffffffffffffff;
|
#ifdef notyet
|
||||||
|
m0->m_flags |= M_TSTMP;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
@@ -1814,10 +1827,7 @@ get_scatter_segment(struct adapter *sc, struct sge_fl *fl, int fr_offset,
|
|||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
fl->mbuf_allocated++;
|
fl->mbuf_allocated++;
|
||||||
#ifdef T4_PKT_TIMESTAMP
|
|
||||||
/* Leave room for a timestamp */
|
|
||||||
m->m_data += 8;
|
|
||||||
#endif
|
|
||||||
/* copy data to mbuf */
|
/* copy data to mbuf */
|
||||||
bcopy(payload, mtod(m, caddr_t), len);
|
bcopy(payload, mtod(m, caddr_t), len);
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ SRCS+= cudbg_wtp.c
|
|||||||
SRCS+= fastlz_api.c
|
SRCS+= fastlz_api.c
|
||||||
SRCS+= fastlz.c
|
SRCS+= fastlz.c
|
||||||
|
|
||||||
# Provide the timestamp of a packet in its header mbuf.
|
|
||||||
#CFLAGS+= -DT4_PKT_TIMESTAMP
|
|
||||||
|
|
||||||
CFLAGS+= -I${CXGBE}
|
CFLAGS+= -I${CXGBE}
|
||||||
|
|
||||||
.include <bsd.kmod.mk>
|
.include <bsd.kmod.mk>
|
||||||
|
|||||||
Reference in New Issue
Block a user