From nobody Mon Sep 25 13:49:45 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RvPPj5wyrz4rMTX; Mon, 25 Sep 2023 13:49:45 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RvPPj54gbz4P7j; Mon, 25 Sep 2023 13:49:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695649785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=13Vv3B/c7hv5Quv5/5pfcf+WXjc4Faoz1qL7LpM+5t0=; b=rFrOOFSFLJ24AJwudGTev8WRJgO6uqVVMf3Dwi5eaLdCXchXQ/EfC/iobnDs6MvcB4tzrP F9VdqV+0jZW4MV62wsy59XCOgWl5gXrkIJ6OkwMCQXbGxUmi9Mx98iTPsYxgj1VFGvBitd SEVx8oJPLCDlzQu8QrMCFAo1T7ugOyYeBY8m/gWZhCXCJXQDlSjrTzrUat+a9ps7OPMFGr M+xoe/Odbjw89VTYEse7J3RIeGdHb20qUunGPByOVYrjKi1tNCVsskNQrNe4wacfrQU17w i8/p5whkYmk8ZRyyiW48wmBTAN66aO8TYHFP1j134RJcwSCBpCQATNJP7ulzOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695649785; a=rsa-sha256; cv=none; b=IF3maPBmRFOwRBgJw2e9Shs2UBLYCCnuoxkdhZz31GGgH3AdMRLh0iZeAzmQ1JfhJ1ICh+ 84mIqRPav+IXqXF9vw38o0ANbQI6wRQ49iAY7+WletClX7LhEO6pbeHOsoXNscdmiWD/Q6 aOekad61kyF/yA+QLEOsrAm/kNY7hfySJUnP68Viu9BbrGwCBpnZV/qLxW7KL7TIvVjNQZ eiwy0qy/ShGr4j+CyWxZYzVVRqpkJ9B2Lc86X9NwS5qS0adXrq+Qx1Gd5cchKHm74jRDc+ cCfQshIz2GpEHJFCVZsKA+rehq5lXZ7EuzzOE2FvKD6SHUF/Tvo1mNr+e3SBEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695649785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=13Vv3B/c7hv5Quv5/5pfcf+WXjc4Faoz1qL7LpM+5t0=; b=ocvwouAeH04GC5wczoLwFXZUt+DSfKmZUUYSKMISLlWBHXKjwbakXFEAJC8m/wc77tFq7P WRhVf5DwnkpYdz8zzaqPKm/UI8cS6X7w4qkLbNP0TqsD62c9TtwmRKQkfm0Up44/e+SkcA vg6eLzq9bvIeFjQ8OxmpwT+ZI7HaPfbvqQO28SH7vwFDpZmCAOeybpZOu1PjdthdXeBO77 yG1lYcG7zYzWIEmzBfNLosyCarvqduQ0tDMl2YsuQ/4pZZ7r5lPD+H0kC5v0BwMkIsBp/v 9JkZNooKIwatcmvREOh191Ox4rlyvc2EZpQ/ARJfHjSuN9w0izQzAUegPWQq/A== 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 4RvPPj3xVsz1rH; Mon, 25 Sep 2023 13:49:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38PDnjlW028624; Mon, 25 Sep 2023 13:49:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38PDnju2028621; Mon, 25 Sep 2023 13:49:45 GMT (envelope-from git) Date: Mon, 25 Sep 2023 13:49:45 GMT Message-Id: <202309251349.38PDnju2028621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 34eb62bb9671 - stable/13 - axge: Skip dummy packet headers List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 34eb62bb9671e87b7aa6b04a4c0a0f9b7e284565 Auto-Submitted: auto-generated The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=34eb62bb9671e87b7aa6b04a4c0a0f9b7e284565 commit 34eb62bb9671e87b7aa6b04a4c0a0f9b7e284565 Author: Damien Broka AuthorDate: 2023-09-13 08:23:47 +0000 Commit: Ed Maste CommitDate: 2023-09-25 13:49:25 +0000 axge: Skip dummy packet headers Newer versions of the AX88179 interweave dummies alongside valid packet headers in bulk IN transfer data. This was probably done for backward compatibility with existing drivers. However current driver records these dummy headers as dropped frames, leading to stats misreporting one Ierr per Ipkt. This skips those dummy headers silently, thereby not generating Ierrs for them. Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/842 (cherry picked from commit 70fbcd451b68b7f6038d8a602cd8d5e1bb890f1d) --- sys/dev/usb/net/if_axge.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/net/if_axge.c b/sys/dev/usb/net/if_axge.c index 2ae0bee38ea1..5cabad95c07f 100644 --- a/sys/dev/usb/net/if_axge.c +++ b/sys/dev/usb/net/if_axge.c @@ -962,8 +962,16 @@ axge_rx_frame(struct usb_ether *ue, struct usb_page_cache *pc, int actlen) hdr_off = pkt_end = (rxhdr >> 16) & 0xFFFF; /* + * On older firmware: * <----------------------- actlen ------------------------> * [frame #0]...[frame #N][pkt_hdr #0]...[pkt_hdr #N][rxhdr] + * + * On newer firmware: + * <----------------------- actlen ----------------- + * [frame #0]...[frame #N][pkt_hdr #0][dummy_hdr]... + * --------------------------------> + * ...[pkt_hdr #N][dummy_hdr][rxhdr] + * * Each RX frame would be aligned on 8 bytes boundary. If * RCR_IPE bit is set in AXGE_RCR register, there would be 2 * padding bytes and 6 dummy bytes(as the padding also should @@ -971,6 +979,10 @@ axge_rx_frame(struct usb_ether *ue, struct usb_page_cache *pc, int actlen) * IP header on 32bits boundary. Driver don't set RCR_IPE bit * of AXGE_RCR register, so there should be no padding bytes * which simplifies RX logic a lot. + * + * Further, newer firmware interweaves dummy headers that have + * pktlen == 0 and should be skipped without being seen as + * dropped frames. */ while (pkt_cnt--) { /* verify the header offset */ @@ -981,6 +993,12 @@ axge_rx_frame(struct usb_ether *ue, struct usb_page_cache *pc, int actlen) usbd_copy_out(pc, hdr_off, &pkt_hdr, sizeof(pkt_hdr)); pkt_hdr.status = le32toh(pkt_hdr.status); pktlen = AXGE_RXBYTES(pkt_hdr.status); + hdr_off += sizeof(pkt_hdr); + + /* Skip dummy packet header. */ + if (pktlen == 0) + continue; + if (pos + pktlen > pkt_end) { DPRINTF("Data position reached end\n"); break; @@ -992,7 +1010,6 @@ axge_rx_frame(struct usb_ether *ue, struct usb_page_cache *pc, int actlen) } else axge_rxeof(ue, pc, pos, pktlen, pkt_hdr.status); pos += (pktlen + 7) & ~7; - hdr_off += sizeof(pkt_hdr); } }