Step 4.1: mechanically rename M_NOMAP to M_EXTPG

Reviewed by:	gallatin
Differential Revision:	https://reviews.freebsd.org/D24598
This commit is contained in:
Gleb Smirnoff 2020-05-03 00:21:11 +00:00
parent 7b6c99d08d
commit 6edfd179c8
16 changed files with 51 additions and 51 deletions

View File

@ -1208,7 +1208,7 @@ t6_ktls_parse_pkt(struct mbuf *m, int *nsegsp, int *len16p)
/* Assume all headers are in 'm' for now. */
MPASS(m->m_next != NULL);
MPASS(m->m_next->m_flags & M_NOMAP);
MPASS(m->m_next->m_flags & M_EXTPG);
tot_len = 0;
@ -1218,7 +1218,7 @@ t6_ktls_parse_pkt(struct mbuf *m, int *nsegsp, int *len16p)
*/
*nsegsp = 0;
for (m_tls = m->m_next; m_tls != NULL; m_tls = m_tls->m_next) {
MPASS(m_tls->m_flags & M_NOMAP);
MPASS(m_tls->m_flags & M_EXTPG);
wr_len = ktls_wr_len(tlsp, m, m_tls, &nsegs);
#ifdef VERBOSE_TRACES
@ -2265,7 +2265,7 @@ t6_ktls_write_wr(struct sge_txq *txq, void *dst, struct mbuf *m, u_int nsegs,
* for that record.
*/
for (m_tls = m->m_next; m_tls != NULL; m_tls = m_tls->m_next) {
MPASS(m_tls->m_flags & M_NOMAP);
MPASS(m_tls->m_flags & M_EXTPG);
/*
* Determine the initial TCP sequence number for this

View File

@ -2497,7 +2497,7 @@ count_mbuf_nsegs(struct mbuf *m, int skip, uint8_t *cflags)
skip -= len;
continue;
}
if ((m->m_flags & M_NOMAP) != 0) {
if ((m->m_flags & M_EXTPG) != 0) {
*cflags |= MC_NOMAP;
nsegs += count_mbuf_ext_pgs(m, skip, &nextaddr);
skip = 0;
@ -5836,7 +5836,7 @@ write_ethofld_wr(struct cxgbe_rate_tag *cst, struct fw_eth_tx_eo_wr *wr,
immhdrs -= m0->m_len;
continue;
}
if (m0->m_flags & M_NOMAP)
if (m0->m_flags & M_EXTPG)
sglist_append_mbuf_epg(&sg, m0,
mtod(m0, vm_offset_t), m0->m_len);
else

View File

@ -610,7 +610,7 @@ write_tx_sgl(void *dst, struct mbuf *start, struct mbuf *stop, int nsegs, int n)
i = -1;
for (m = start; m != stop; m = m->m_next) {
if (m->m_flags & M_NOMAP)
if (m->m_flags & M_EXTPG)
rc = sglist_append_mbuf_epg(&sg, m,
mtod(m, vm_offset_t), m->m_len);
else
@ -731,7 +731,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop)
for (m = sndptr; m != NULL; m = m->m_next) {
int n;
if (m->m_flags & M_NOMAP) {
if (m->m_flags & M_EXTPG) {
#ifdef KERN_TLS
if (m->m_epg_tls != NULL) {
toep->flags |= TPF_KTLS;
@ -772,7 +772,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep, int drop)
break;
}
if (m->m_flags & M_NOMAP)
if (m->m_flags & M_EXTPG)
nomap_mbuf_seen = true;
if (max_nsegs_1mbuf < n)
max_nsegs_1mbuf = n;

View File

@ -1796,7 +1796,7 @@ t4_push_ktls(struct adapter *sc, struct toepcb *toep, int drop)
return;
}
KASSERT(m->m_flags & M_NOMAP, ("%s: mbuf %p is not NOMAP",
KASSERT(m->m_flags & M_EXTPG, ("%s: mbuf %p is not NOMAP",
__func__, m));
KASSERT(m->m_epg_tls != NULL,
("%s: mbuf %p doesn't have TLS session", __func__, m));

View File

@ -624,7 +624,7 @@ sbtls_recover_record(struct mbuf *mb, int wait, uint32_t tcp_old, uint32_t *ptcp
/* check format of incoming mbuf */
if (mb->m_next == NULL ||
(mb->m_next->m_flags & (M_NOMAP | M_EXT)) != (M_NOMAP | M_EXT)) {
(mb->m_next->m_flags & (M_EXTPG | M_EXT)) != (M_EXTPG | M_EXT)) {
top = NULL;
goto done;
}
@ -682,7 +682,7 @@ mlx5e_sq_tls_populate(struct mbuf *mb, uint64_t *pseq)
{
for (; mb != NULL; mb = mb->m_next) {
if (!(mb->m_flags & M_NOMAP))
if (!(mb->m_flags & M_EXTPG))
continue;
*pseq = mb->m_epg_seqno;
return (1);

View File

@ -882,7 +882,7 @@ mb_unmapped_compress(struct mbuf *m)
m->m_ext.ext_free(m);
/* Turn 'm' into a "normal" mbuf. */
m->m_flags &= ~(M_EXT | M_RDONLY | M_NOMAP);
m->m_flags &= ~(M_EXT | M_RDONLY | M_EXTPG);
m->m_data = m->m_dat;
/* Copy data back into m. */
@ -1071,7 +1071,7 @@ mb_unmapped_to_ext(struct mbuf *top)
for (m = top; m != NULL; m = next) {
/* m might be freed, so cache the next pointer. */
next = m->m_next;
if (m->m_flags & M_NOMAP) {
if (m->m_flags & M_EXTPG) {
if (prev != NULL) {
/*
* Remove 'm' from the new chain so
@ -1132,7 +1132,7 @@ mb_alloc_ext_pgs(int how, m_ext_free_t ext_free)
m->m_epg_tls = NULL;
m->m_epg_so = NULL;
m->m_data = NULL;
m->m_flags |= (M_EXT | M_RDONLY | M_NOMAP);
m->m_flags |= (M_EXT | M_RDONLY | M_EXTPG);
m->m_ext.ext_type = EXT_PGS;
m->m_ext.ext_flags = EXT_FLAG_EMBREF;
m->m_ext.ext_count = 1;

View File

@ -845,7 +845,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
#ifdef KERN_TLS
if (tls != NULL)
mh = m_uiotombuf(hdr_uio, M_WAITOK, space,
tls->params.max_frame_len, M_NOMAP);
tls->params.max_frame_len, M_EXTPG);
else
#endif
mh = m_uiotombuf(hdr_uio, M_WAITOK,

View File

@ -184,7 +184,7 @@ _bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map,
error = 0;
for (m = m0; m != NULL && error == 0; m = m->m_next) {
if (m->m_len > 0) {
if ((m->m_flags & M_NOMAP) != 0)
if ((m->m_flags & M_EXTPG) != 0)
error = _bus_dmamap_load_mbuf_epg(dmat,
map, m, segs, nsegs, flags);
else

View File

@ -451,7 +451,7 @@ sglist_append_mbuf(struct sglist *sg, struct mbuf *m0)
SGLIST_SAVE(sg, save);
for (m = m0; m != NULL; m = m->m_next) {
if (m->m_len > 0) {
if ((m->m_flags & M_NOMAP) != 0)
if ((m->m_flags & M_EXTPG) != 0)
error = sglist_append_mbuf_epg(sg, m,
mtod(m, vm_offset_t), m->m_len);
else

View File

@ -1289,7 +1289,7 @@ ktls_seq(struct sockbuf *sb, struct mbuf *m)
{
for (; m != NULL; m = m->m_next) {
KASSERT((m->m_flags & M_NOMAP) != 0,
KASSERT((m->m_flags & M_EXTPG) != 0,
("ktls_seq: mapped mbuf %p", m));
m->m_epg_seqno = sb->sb_tls_seqno;
@ -1334,7 +1334,7 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, int *enq_cnt,
* TLS frames require unmapped mbufs to store session
* info.
*/
KASSERT((m->m_flags & M_NOMAP) != 0,
KASSERT((m->m_flags & M_EXTPG) != 0,
("ktls_frame: mapped mbuf %p (top = %p)\n", m, top));
tls_len = m->m_len;
@ -1448,8 +1448,8 @@ ktls_enqueue(struct mbuf *m, struct socket *so, int page_count)
struct ktls_wq *wq;
bool running;
KASSERT(((m->m_flags & (M_NOMAP | M_NOTREADY)) ==
(M_NOMAP | M_NOTREADY)),
KASSERT(((m->m_flags & (M_EXTPG | M_NOTREADY)) ==
(M_EXTPG | M_NOTREADY)),
("ktls_enqueue: %p not unready & nomap mbuf\n", m));
KASSERT(page_count != 0, ("enqueueing TLS mbuf with zero page count"));
@ -1518,8 +1518,8 @@ ktls_encrypt(struct mbuf *top)
KASSERT(m->m_epg_tls == tls,
("different TLS sessions in a single mbuf chain: %p vs %p",
tls, m->m_epg_tls));
KASSERT((m->m_flags & (M_NOMAP | M_NOTREADY)) ==
(M_NOMAP | M_NOTREADY),
KASSERT((m->m_flags & (M_EXTPG | M_NOTREADY)) ==
(M_EXTPG | M_NOTREADY),
("%p not unready & nomap mbuf (top = %p)\n", m, top));
KASSERT(npages + m->m_epg_npgs <= total_pages,
("page count mismatch: top %p, total_pages %d, m %p", top,

View File

@ -220,7 +220,7 @@ mb_dupcl(struct mbuf *n, struct mbuf *m)
}
n->m_flags |= M_EXT;
n->m_flags |= m->m_flags & (M_RDONLY | M_NOMAP);
n->m_flags |= m->m_flags & (M_RDONLY | M_EXTPG);
/* See if this is the mbuf that holds the embedded refcount. */
if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) {
@ -265,7 +265,7 @@ m_demote(struct mbuf *m0, int all, int flags)
if (m->m_flags & M_PKTHDR)
m_demote_pkthdr(m);
m->m_flags = m->m_flags & (M_EXT | M_RDONLY | M_NOFREE |
M_NOMAP | flags);
M_EXTPG | flags);
}
}
@ -396,7 +396,7 @@ m_move_pkthdr(struct mbuf *to, struct mbuf *from)
m_tag_delete_chain(to, NULL);
#endif
to->m_flags = (from->m_flags & M_COPYFLAGS) |
(to->m_flags & (M_EXT | M_NOMAP));
(to->m_flags & (M_EXT | M_EXTPG));
if ((to->m_flags & M_EXT) == 0)
to->m_data = to->m_pktdat;
to->m_pkthdr = from->m_pkthdr; /* especially tags */
@ -435,7 +435,7 @@ m_dup_pkthdr(struct mbuf *to, const struct mbuf *from, int how)
m_tag_delete_chain(to, NULL);
#endif
to->m_flags = (from->m_flags & M_COPYFLAGS) |
(to->m_flags & (M_EXT | M_NOMAP));
(to->m_flags & (M_EXT | M_EXTPG));
if ((to->m_flags & M_EXT) == 0)
to->m_data = to->m_pktdat;
to->m_pkthdr = from->m_pkthdr;
@ -645,7 +645,7 @@ m_copydata(const struct mbuf *m, int off, int len, caddr_t cp)
while (len > 0) {
KASSERT(m != NULL, ("m_copydata, length > size of mbuf chain"));
count = min(m->m_len - off, len);
if ((m->m_flags & M_NOMAP) != 0)
if ((m->m_flags & M_EXTPG) != 0)
m_copyfromunmapped(m, off, count, cp);
else
bcopy(mtod(m, caddr_t) + off, cp, count);
@ -743,7 +743,7 @@ m_cat(struct mbuf *m, struct mbuf *n)
m = m->m_next;
while (n) {
if (!M_WRITABLE(m) ||
(n->m_flags & M_NOMAP) != 0 ||
(n->m_flags & M_EXTPG) != 0 ||
M_TRAILINGSPACE(m) < n->m_len) {
/* just join the two chains */
m->m_next = n;
@ -861,7 +861,7 @@ m_pullup(struct mbuf *n, int len)
int count;
int space;
KASSERT((n->m_flags & M_NOMAP) == 0,
KASSERT((n->m_flags & M_EXTPG) == 0,
("%s: unmapped mbuf %p", __func__, n));
/*
@ -1429,7 +1429,7 @@ frags_per_mbuf(struct mbuf *m)
{
int frags;
if ((m->m_flags & M_NOMAP) == 0)
if ((m->m_flags & M_EXTPG) == 0)
return (1);
/*
@ -1718,7 +1718,7 @@ m_uiotombuf(struct uio *uio, int how, int len, int align, int flags)
ssize_t total;
int progress = 0;
if (flags & M_NOMAP)
if (flags & M_EXTPG)
return (m_uiotombuf_nomap(uio, how, len, align, flags));
/*
@ -1840,7 +1840,7 @@ m_mbuftouio(struct uio *uio, const struct mbuf *m, int len)
for (; m != NULL; m = m->m_next) {
length = min(m->m_len, total - progress);
if ((m->m_flags & M_NOMAP) != 0)
if ((m->m_flags & M_EXTPG) != 0)
error = m_unmappedtouio(m, 0, uio, length);
else
error = uiomove(mtod(m, void *), length, uio);

View File

@ -124,8 +124,8 @@ sbready_compress(struct sockbuf *sb, struct mbuf *m0, struct mbuf *end)
#ifdef KERN_TLS
/* Try to coalesce adjacent ktls mbuf hdr/trailers. */
if ((n != NULL) && (n != end) && (m->m_flags & M_EOR) == 0 &&
(m->m_flags & M_NOMAP) &&
(n->m_flags & M_NOMAP) &&
(m->m_flags & M_EXTPG) &&
(n->m_flags & M_EXTPG) &&
!mbuf_has_tls_session(m) &&
!mbuf_has_tls_session(n)) {
int hdr_len, trail_len;
@ -146,7 +146,7 @@ sbready_compress(struct sockbuf *sb, struct mbuf *m0, struct mbuf *end)
#endif
/* Compress small unmapped mbufs into plain mbufs. */
if ((m->m_flags & M_NOMAP) && m->m_len <= MLEN &&
if ((m->m_flags & M_EXTPG) && m->m_len <= MLEN &&
!mbuf_has_tls_session(m)) {
MPASS(m->m_flags & M_EXT);
ext_size = m->m_ext.ext_size;
@ -158,7 +158,7 @@ sbready_compress(struct sockbuf *sb, struct mbuf *m0, struct mbuf *end)
while ((n != NULL) && (n != end) && (m->m_flags & M_EOR) == 0 &&
M_WRITABLE(m) &&
(m->m_flags & M_NOMAP) == 0 &&
(m->m_flags & M_EXTPG) == 0 &&
!mbuf_has_tls_session(n) &&
!mbuf_has_tls_session(m) &&
n->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */
@ -1172,7 +1172,7 @@ sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n)
M_WRITABLE(n) &&
((sb->sb_flags & SB_NOCOALESCE) == 0) &&
!(m->m_flags & M_NOTREADY) &&
!(n->m_flags & (M_NOTREADY | M_NOMAP)) &&
!(n->m_flags & (M_NOTREADY | M_EXTPG)) &&
!mbuf_has_tls_session(m) &&
!mbuf_has_tls_session(n) &&
m->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */
@ -1189,7 +1189,7 @@ sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n)
m = m_free(m);
continue;
}
if (m->m_len <= MLEN && (m->m_flags & M_NOMAP) &&
if (m->m_len <= MLEN && (m->m_flags & M_EXTPG) &&
(m->m_flags & M_NOTREADY) == 0 &&
!mbuf_has_tls_session(m))
(void)mb_unmapped_compress(m);

View File

@ -1691,7 +1691,7 @@ sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio,
if (tls != NULL) {
top = m_uiotombuf(uio, M_WAITOK, space,
tls->params.max_frame_len,
M_NOMAP |
M_EXTPG |
((flags & MSG_EOR) ? M_EOR : 0));
if (top != NULL) {
ktls_frame(top, tls,
@ -2159,7 +2159,7 @@ soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio,
SBLASTRECORDCHK(&so->so_rcv);
SBLASTMBUFCHK(&so->so_rcv);
SOCKBUF_UNLOCK(&so->so_rcv);
if ((m->m_flags & M_NOMAP) != 0)
if ((m->m_flags & M_EXTPG) != 0)
error = m_unmappedtouio(m, moff, uio, (int)len);
else
error = uiomove(mtod(m, char *) + moff,

View File

@ -1911,7 +1911,7 @@ tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen,
top = NULL;
pkthdrlen = NULL;
#ifdef KERN_TLS
if (hw_tls && (m->m_flags & M_NOMAP))
if (hw_tls && (m->m_flags & M_EXTPG))
tls = m->m_epg_tls;
else
tls = NULL;
@ -1928,7 +1928,7 @@ tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen,
}
#ifdef KERN_TLS
if (hw_tls) {
if (m->m_flags & M_NOMAP)
if (m->m_flags & M_EXTPG)
ntls = m->m_epg_tls;
else
ntls = NULL;
@ -1961,14 +1961,14 @@ tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen,
mlen = min(len, m->m_len - off);
if (seglimit) {
/*
* For M_NOMAP mbufs, add 3 segments
* For M_EXTPG mbufs, add 3 segments
* + 1 in case we are crossing page boundaries
* + 2 in case the TLS hdr/trailer are used
* It is cheaper to just add the segments
* than it is to take the cache miss to look
* at the mbuf ext_pgs state in detail.
*/
if (m->m_flags & M_NOMAP) {
if (m->m_flags & M_EXTPG) {
fragsize = min(segsize, PAGE_SIZE);
frags = 3;
} else {

View File

@ -384,7 +384,7 @@ tcp_pcap_add(struct tcphdr *th, struct mbuf *m, struct mbufq *queue)
__func__, n->m_flags));
n->m_data = n->m_dat + M_LEADINGSPACE_NOWRITE(m);
n->m_len = m->m_len;
if (m->m_flags & M_NOMAP)
if (m->m_flags & M_EXTPG)
m_copydata(m, 0, m->m_len, n->m_data);
else
bcopy(M_START(m), n->m_dat,

View File

@ -450,7 +450,7 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff)
#define M_MCAST 0x00000020 /* send/received as link-level multicast */
#define M_PROMISC 0x00000040 /* packet was not for us */
#define M_VLANTAG 0x00000080 /* ether_vtag is valid */
#define M_NOMAP 0x00000100 /* mbuf data is unmapped */
#define M_EXTPG 0x00000100 /* has array of unmapped pages and TLS */
#define M_NOFREE 0x00000200 /* do not free mbuf, embedded in cluster */
#define M_TSTMP 0x00000400 /* rcv_tstmp field is valid */
#define M_TSTMP_HPREC 0x00000800 /* rcv_tstmp is high-prec, typically
@ -491,7 +491,7 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff)
*/
#define M_FLAG_BITS \
"\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY\5M_BCAST\6M_MCAST" \
"\7M_PROMISC\10M_VLANTAG\11M_NOMAP\12M_NOFREE\13M_TSTMP\14M_TSTMP_HPREC\15M_TSTMP_LRO"
"\7M_PROMISC\10M_VLANTAG\11M_EXTPG\12M_NOFREE\13M_TSTMP\14M_TSTMP_HPREC\15M_TSTMP_LRO"
#define M_FLAG_PROTOBITS \
"\16M_PROTO1\17M_PROTO2\20M_PROTO3\21M_PROTO4" \
"\22M_PROTO5\23M_PROTO6\24M_PROTO7\25M_PROTO8\26M_PROTO9" \
@ -1038,7 +1038,7 @@ m_extrefcnt(struct mbuf *m)
* be both the local data payload, or an external buffer area, depending on
* whether M_EXT is set).
*/
#define M_WRITABLE(m) (((m)->m_flags & (M_RDONLY | M_NOMAP)) == 0 && \
#define M_WRITABLE(m) (((m)->m_flags & (M_RDONLY | M_EXTPG)) == 0 && \
(!(((m)->m_flags & M_EXT)) || \
(m_extrefcnt(m) == 1)))
@ -1061,7 +1061,7 @@ m_extrefcnt(struct mbuf *m)
* handling external storage, packet-header mbufs, and regular data mbufs.
*/
#define M_START(m) \
(((m)->m_flags & M_NOMAP) ? NULL : \
(((m)->m_flags & M_EXTPG) ? NULL : \
((m)->m_flags & M_EXT) ? (m)->m_ext.ext_buf : \
((m)->m_flags & M_PKTHDR) ? &(m)->m_pktdat[0] : \
&(m)->m_dat[0])
@ -1559,7 +1559,7 @@ static inline bool
mbuf_has_tls_session(struct mbuf *m)
{
if (m->m_flags & M_NOMAP) {
if (m->m_flags & M_EXTPG) {
MBUF_EXT_PGS_ASSERT(m);
if (m->m_epg_tls != NULL) {
return (true);