Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 May 2020 23:52:35 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r360575 - in head/sys: dev/cxgbe dev/cxgbe/tom kern sys
Message-ID:  <202005022352.042NqZr2084631@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Sat May  2 23:52:35 2020
New Revision: 360575
URL: https://svnweb.freebsd.org/changeset/base/360575

Log:
  Step 2.3: Rename mbuf_ext_pg_len() to m_epg_pagelen() that
            uses mbuf argument.
  
  Reviewed by:	gallatin
  Differential Revision:	https://reviews.freebsd.org/D24598

Modified:
  head/sys/dev/cxgbe/t4_sge.c
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/subr_bus_dma.c
  head/sys/kern/subr_sglist.c
  head/sys/kern/uipc_ktls.c
  head/sys/kern/uipc_mbuf.c
  head/sys/sys/mbuf.h

Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c	Sat May  2 23:46:29 2020	(r360574)
+++ head/sys/dev/cxgbe/t4_sge.c	Sat May  2 23:52:35 2020	(r360575)
@@ -2441,7 +2441,7 @@ count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_
 	}
 	pgoff = m->m_ext_pgs.first_pg_off;
 	for (i = 0; i < m->m_ext_pgs.npgs && len > 0; i++) {
-		pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff);
+		pglen = m_epg_pagelen(m, i, pgoff);
 		if (off >= pglen) {
 			off -= pglen;
 			pgoff = 0;

Modified: head/sys/dev/cxgbe/tom/t4_tls.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tls.c	Sat May  2 23:46:29 2020	(r360574)
+++ head/sys/dev/cxgbe/tom/t4_tls.c	Sat May  2 23:52:35 2020	(r360575)
@@ -1655,13 +1655,13 @@ write_ktlstx_sgl(void *dst, struct mbuf *m, int nsegs)
 	/* Figure out the first S/G length. */
 	pa = m->m_epg_pa[0] + m->m_ext_pgs.first_pg_off;
 	usgl->addr0 = htobe64(pa);
-	len = mbuf_ext_pg_len(&m->m_ext_pgs, 0, m->m_ext_pgs.first_pg_off);
+	len = m_epg_pagelen(m, 0, m->m_ext_pgs.first_pg_off);
 	pa += len;
 	for (i = 1; i < m->m_ext_pgs.npgs; i++) {
 		if (m->m_epg_pa[i] != pa)
 			break;
-		len += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
-		pa += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
+		len += m_epg_pagelen(m, i, 0);
+		pa += m_epg_pagelen(m, i, 0);
 	}
 	usgl->len0 = htobe32(len);
 #ifdef INVARIANTS
@@ -1679,11 +1679,11 @@ write_ktlstx_sgl(void *dst, struct mbuf *m, int nsegs)
 #endif
 			pa = m->m_epg_pa[i];
 			usgl->sge[j / 2].addr[j & 1] = htobe64(pa);
-			len = mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
+			len = m_epg_pagelen(m, i, 0);
 			pa += len;
 		} else {
-			len += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
-			pa += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0);
+			len += m_epg_pagelen(m, i, 0);
+			pa += m_epg_pagelen(m, i, 0);
 		}
 	}
 	if (j >= 0) {

Modified: head/sys/kern/kern_mbuf.c
==============================================================================
--- head/sys/kern/kern_mbuf.c	Sat May  2 23:46:29 2020	(r360574)
+++ head/sys/kern/kern_mbuf.c	Sat May  2 23:52:35 2020	(r360575)
@@ -983,7 +983,7 @@ _mb_unmapped_to_ext(struct mbuf *m)
 	}
 	pgoff = ext_pgs->first_pg_off;
 	for (i = 0; i < ext_pgs->npgs && len > 0; i++) {
-		pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff);
+		pglen = m_epg_pagelen(m, i, pgoff);
 		if (off >= pglen) {
 			off -= pglen;
 			pgoff = 0;

Modified: head/sys/kern/subr_bus_dma.c
==============================================================================
--- head/sys/kern/subr_bus_dma.c	Sat May  2 23:46:29 2020	(r360574)
+++ head/sys/kern/subr_bus_dma.c	Sat May  2 23:52:35 2020	(r360575)
@@ -145,7 +145,7 @@ _bus_dmamap_load_mbuf_epg(bus_dma_tag_t dmat, bus_dmam
 	}
 	pgoff = m->m_ext_pgs.first_pg_off;
 	for (i = 0; i < m->m_ext_pgs.npgs && error == 0 && len > 0; i++) {
-		pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff);
+		pglen = m_epg_pagelen(m, i, pgoff);
 		if (off >= pglen) {
 			off -= pglen;
 			pgoff = 0;

Modified: head/sys/kern/subr_sglist.c
==============================================================================
--- head/sys/kern/subr_sglist.c	Sat May  2 23:46:29 2020	(r360574)
+++ head/sys/kern/subr_sglist.c	Sat May  2 23:52:35 2020	(r360575)
@@ -249,7 +249,7 @@ sglist_count_mbuf_epg(struct mbuf *m, size_t off, size
 	nextaddr = 0;
 	pgoff = m->m_ext_pgs.first_pg_off;
 	for (i = 0; i < m->m_ext_pgs.npgs && len > 0; i++) {
-		pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff);
+		pglen = m_epg_pagelen(m, i, pgoff);
 		if (off >= pglen) {
 			off -= pglen;
 			pgoff = 0;
@@ -406,7 +406,7 @@ sglist_append_mbuf_epg(struct sglist *sg, struct mbuf 
 	}
 	pgoff = m->m_ext_pgs.first_pg_off;
 	for (i = 0; i < m->m_ext_pgs.npgs && error == 0 && len > 0; i++) {
-		pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff);
+		pglen = m_epg_pagelen(m, i, pgoff);
 		if (off >= pglen) {
 			off -= pglen;
 			pgoff = 0;

Modified: head/sys/kern/uipc_ktls.c
==============================================================================
--- head/sys/kern/uipc_ktls.c	Sat May  2 23:46:29 2020	(r360574)
+++ head/sys/kern/uipc_ktls.c	Sat May  2 23:52:35 2020	(r360575)
@@ -1550,7 +1550,7 @@ ktls_encrypt(struct mbuf *top)
 
 		off = pgs->first_pg_off;
 		for (i = 0; i < pgs->npgs; i++, off = 0) {
-			len = mbuf_ext_pg_len(pgs, i, off);
+			len = m_epg_pagelen(m, i, off);
 			src_iov[i].iov_len = len;
 			src_iov[i].iov_base =
 			    (char *)(void *)PHYS_TO_DMAP(m->m_epg_pa[i]) +

Modified: head/sys/kern/uipc_mbuf.c
==============================================================================
--- head/sys/kern/uipc_mbuf.c	Sat May  2 23:46:29 2020	(r360574)
+++ head/sys/kern/uipc_mbuf.c	Sat May  2 23:52:35 2020	(r360575)
@@ -1805,7 +1805,7 @@ m_unmappedtouio(const struct mbuf *m, int m_off, struc
 	}
 	pgoff = ext_pgs->first_pg_off;
 	for (i = 0; i < ext_pgs->npgs && error == 0 && len > 0; i++) {
-		pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff);
+		pglen = m_epg_pagelen(m, i, pgoff);
 		if (off >= pglen) {
 			off -= pglen;
 			pgoff = 0;

Modified: head/sys/sys/mbuf.h
==============================================================================
--- head/sys/sys/mbuf.h	Sat May  2 23:46:29 2020	(r360574)
+++ head/sys/sys/mbuf.h	Sat May  2 23:52:35 2020	(r360575)
@@ -388,12 +388,14 @@ struct mbuf {
 
 #ifdef _KERNEL
 static inline int
-mbuf_ext_pg_len(struct mbuf_ext_pgs *ext_pgs, int pidx, int pgoff)
+m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff)
 {
+
 	KASSERT(pgoff == 0 || pidx == 0,
-	    ("page %d with non-zero offset %d in %p", pidx, pgoff, ext_pgs));
-	if (pidx == ext_pgs->npgs - 1) {
-		return (ext_pgs->last_pg_len);
+	    ("page %d with non-zero offset %d in %p", pidx, pgoff, m));
+
+	if (pidx == m->m_ext_pgs.npgs - 1) {
+		return (m->m_ext_pgs.last_pg_len);
 	} else {
 		return (PAGE_SIZE - pgoff);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005022352.042NqZr2084631>