From owner-dev-commits-src-all@freebsd.org Sun Jan 10 09:11:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DA554BCF69; Sun, 10 Jan 2021 09:11:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DDB0F1mvTz3tkN; Sun, 10 Jan 2021 09:11:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FD4025A67; Sun, 10 Jan 2021 09:11:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10A9B92J061577; Sun, 10 Jan 2021 09:11:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10A9B9Ji061576; Sun, 10 Jan 2021 09:11:09 GMT (envelope-from git) Date: Sun, 10 Jan 2021 09:11:09 GMT Message-Id: <202101100911.10A9B9Ji061576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: af352cf1397f - stable/12 - netmap: bridge: fix NS_MOREFRAG support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: af352cf1397fd3ada7d565c4a52c71b71ea2b3b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Jan 2021 09:11:09 -0000 The branch stable/12 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=af352cf1397fd3ada7d565c4a52c71b71ea2b3b3 commit af352cf1397fd3ada7d565c4a52c71b71ea2b3b3 Author: Vincenzo Maffione AuthorDate: 2021-01-07 07:00:43 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-10 09:10:29 +0000 netmap: bridge: fix NS_MOREFRAG support Support for NS_MOREFRAG is broken, as NS_MOREFRAG is copied from the TX slot to the RX slot rather than the other way around. Also, the NS_MOREFRAG must be copied also in case of packet copy (no zerocopy). Reported by: rajesh1.kumar_amd.com Differential Revision: https://reviews.freebsd.org/D27980 (cherry picked from commit 163f4f15733f82584a967538cf2340bf1b6a245f) --- tools/tools/netmap/bridge.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/tools/netmap/bridge.c b/tools/tools/netmap/bridge.c index af8c2847130a..77d235bf6e08 100644 --- a/tools/tools/netmap/bridge.c +++ b/tools/tools/netmap/bridge.c @@ -86,13 +86,12 @@ rings_move(struct netmap_ring *rxring, struct netmap_ring *txring, struct netmap_slot *rs = &rxring->slot[j]; struct netmap_slot *ts = &txring->slot[k]; - /* swap packets */ if (ts->buf_idx < 2 || rs->buf_idx < 2) { RD(2, "wrong index rxr[%d] = %d -> txr[%d] = %d", j, rs->buf_idx, k, ts->buf_idx); sleep(2); } - /* copy the packet length. */ + /* Copy the packet length. */ if (rs->len > rxring->nr_buf_size) { RD(2, "%s: invalid len %u, rxr[%d] -> txr[%d]", msg, rs->len, j, k); @@ -109,13 +108,16 @@ rings_move(struct netmap_ring *rxring, struct netmap_ring *txring, /* report the buffer change. */ ts->flags |= NS_BUF_CHANGED; rs->flags |= NS_BUF_CHANGED; - /* copy the NS_MOREFRAG */ - rs->flags = (rs->flags & ~NS_MOREFRAG) | (ts->flags & NS_MOREFRAG); } else { char *rxbuf = NETMAP_BUF(rxring, rs->buf_idx); char *txbuf = NETMAP_BUF(txring, ts->buf_idx); nm_pkt_copy(rxbuf, txbuf, ts->len); } + /* + * Copy the NS_MOREFRAG from rs to ts, leaving any + * other flags unchanged. + */ + ts->flags = (ts->flags & ~NS_MOREFRAG) | (rs->flags & NS_MOREFRAG); j = nm_ring_next(rxring, j); k = nm_ring_next(txring, k); } @@ -190,7 +192,7 @@ usage(void) int main(int argc, char **argv) { - char msg_a2b[128], msg_b2a[128]; + char msg_a2b[256], msg_b2a[256]; struct pollfd pollfd[2]; u_int burst = 1024, wait_link = 4; struct nmport_d *pa = NULL, *pb = NULL;