mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
cxgbe: Move helper functions for mbuf metadata to adapter.h.
Previously private to t4_sge.c, this allows other parts of the driver (such as NIC TLS) to use these helpers directly. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D38578
This commit is contained in:
parent
8afd23de92
commit
b919bf0596
2 changed files with 58 additions and 63 deletions
|
|
@ -1118,6 +1118,64 @@ hw_off_limits(struct adapter *sc)
|
|||
return (__predict_false(off_limits != 0));
|
||||
}
|
||||
|
||||
static inline int
|
||||
mbuf_nsegs(struct mbuf *m)
|
||||
{
|
||||
M_ASSERTPKTHDR(m);
|
||||
KASSERT(m->m_pkthdr.inner_l5hlen > 0,
|
||||
("%s: mbuf %p missing information on # of segments.", __func__, m));
|
||||
|
||||
return (m->m_pkthdr.inner_l5hlen);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_mbuf_nsegs(struct mbuf *m, uint8_t nsegs)
|
||||
{
|
||||
M_ASSERTPKTHDR(m);
|
||||
m->m_pkthdr.inner_l5hlen = nsegs;
|
||||
}
|
||||
|
||||
/* Internal mbuf flags stored in PH_loc.eight[1]. */
|
||||
#define MC_NOMAP 0x01
|
||||
#define MC_RAW_WR 0x02
|
||||
#define MC_TLS 0x04
|
||||
|
||||
static inline int
|
||||
mbuf_cflags(struct mbuf *m)
|
||||
{
|
||||
M_ASSERTPKTHDR(m);
|
||||
return (m->m_pkthdr.PH_loc.eight[4]);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_mbuf_cflags(struct mbuf *m, uint8_t flags)
|
||||
{
|
||||
M_ASSERTPKTHDR(m);
|
||||
m->m_pkthdr.PH_loc.eight[4] = flags;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mbuf_len16(struct mbuf *m)
|
||||
{
|
||||
int n;
|
||||
|
||||
M_ASSERTPKTHDR(m);
|
||||
n = m->m_pkthdr.PH_loc.eight[0];
|
||||
if (!(mbuf_cflags(m) & MC_TLS))
|
||||
MPASS(n > 0 && n <= SGE_MAX_WR_LEN / 16);
|
||||
|
||||
return (n);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_mbuf_len16(struct mbuf *m, uint8_t len16)
|
||||
{
|
||||
M_ASSERTPKTHDR(m);
|
||||
if (!(mbuf_cflags(m) & MC_TLS))
|
||||
MPASS(len16 > 0 && len16 <= SGE_MAX_WR_LEN / 16);
|
||||
m->m_pkthdr.PH_loc.eight[0] = len16;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
t4_read_reg(struct adapter *sc, uint32_t reg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,11 +87,6 @@ __FBSDID("$FreeBSD$");
|
|||
#define RX_COPY_THRESHOLD MINCLSIZE
|
||||
#endif
|
||||
|
||||
/* Internal mbuf flags stored in PH_loc.eight[1]. */
|
||||
#define MC_NOMAP 0x01
|
||||
#define MC_RAW_WR 0x02
|
||||
#define MC_TLS 0x04
|
||||
|
||||
/*
|
||||
* Ethernet frames are DMA'd at this byte offset into the freelist buffer.
|
||||
* 0-7 are valid values.
|
||||
|
|
@ -2284,64 +2279,6 @@ t4_update_fl_bufsize(struct ifnet *ifp)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline int
|
||||
mbuf_nsegs(struct mbuf *m)
|
||||
{
|
||||
|
||||
M_ASSERTPKTHDR(m);
|
||||
KASSERT(m->m_pkthdr.inner_l5hlen > 0,
|
||||
("%s: mbuf %p missing information on # of segments.", __func__, m));
|
||||
|
||||
return (m->m_pkthdr.inner_l5hlen);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_mbuf_nsegs(struct mbuf *m, uint8_t nsegs)
|
||||
{
|
||||
|
||||
M_ASSERTPKTHDR(m);
|
||||
m->m_pkthdr.inner_l5hlen = nsegs;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mbuf_cflags(struct mbuf *m)
|
||||
{
|
||||
|
||||
M_ASSERTPKTHDR(m);
|
||||
return (m->m_pkthdr.PH_loc.eight[4]);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_mbuf_cflags(struct mbuf *m, uint8_t flags)
|
||||
{
|
||||
|
||||
M_ASSERTPKTHDR(m);
|
||||
m->m_pkthdr.PH_loc.eight[4] = flags;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mbuf_len16(struct mbuf *m)
|
||||
{
|
||||
int n;
|
||||
|
||||
M_ASSERTPKTHDR(m);
|
||||
n = m->m_pkthdr.PH_loc.eight[0];
|
||||
if (!(mbuf_cflags(m) & MC_TLS))
|
||||
MPASS(n > 0 && n <= SGE_MAX_WR_LEN / 16);
|
||||
|
||||
return (n);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_mbuf_len16(struct mbuf *m, uint8_t len16)
|
||||
{
|
||||
|
||||
M_ASSERTPKTHDR(m);
|
||||
if (!(mbuf_cflags(m) & MC_TLS))
|
||||
MPASS(len16 > 0 && len16 <= SGE_MAX_WR_LEN / 16);
|
||||
m->m_pkthdr.PH_loc.eight[0] = len16;
|
||||
}
|
||||
|
||||
#ifdef RATELIMIT
|
||||
static inline int
|
||||
mbuf_eo_nsegs(struct mbuf *m)
|
||||
|
|
|
|||
Loading…
Reference in a new issue