From nobody Sun Sep 24 13:19:58 2023 X-Original-To: dev-commits-src-all@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 4Rtmnq1CX9z4tyC5; Sun, 24 Sep 2023 13:19:59 +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 4Rtmnq0PQRz4WjK; Sun, 24 Sep 2023 13:19:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695561599; 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=XKE13mTnrfJ2BQVjxXd736IomTNHDyyoxuz33AVPUf8=; b=eGs15ioojCJNM6On6BrJeqTgo/OVqZqVhI+KwUo8ziU5K/RebXhTyvCpJvAxPc0ouIxSVr W/QksflrmTJ3Xu3qpwmAquy1rpRZc0wnps8kaFMtuLt9d0C4y1Rcydzq/N+kWQuWQ52rRy 1WHJ0145WQuSQnFeYLeLgaqopTFPeDN/cnqKlSLo9RQf873DVe2U5hPg+54UGO6NHiNrKB AzZWfPGJMMsgajOZ9pFkkSnTHG71kEDcS9p4hRzesbtBxF8pI2reWNMwK5L8N+o6VFIGYl jv5RaI0d/tx4AdFA/3LwGPyd6KgiGhku3usvE6judWrGveHPURpJuDNVRyTKqQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695561599; a=rsa-sha256; cv=none; b=KoyZ2uE75OCQEeDcNavTECl8kD/zYxgCBS23OfpbI/XZuTkBoDggHutnjHGYIg4IbaliwN a9MGLwBNdKV2hsu0yNJGqNyAhF7j4Ycy/+RD6A4qHyTgm3QCP7hRyOzK7QnlsHcHVOYYEW TjGLPUBh4f1YkE7Nb65jh4i3o0+VUL3mcPddoCQjbrbaXPLl9gtCe5c6yjQoOQSrKqmhh3 GDWTprBBdw5w5AaKGa7U9rsJZX3fRhAoomSW4HFZ1DdAXUt2GDMvqwetQ7MGsuwE66QvHf gz3TvFdg+ckDCFWdOot+/mFHtHXqRbWT99D2270Yt83CtsYeXQSJs4eIcyMqfw== 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=1695561599; 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=XKE13mTnrfJ2BQVjxXd736IomTNHDyyoxuz33AVPUf8=; b=XPXUWW1CKfmOTySIre1++cH7AFvTdNYSCPyPQjQG40IskP9C0J61YGnsRAMqTW2cG43G9S pc6knpBchoNUhmmpuyxwiXlQyGgXEBWPcBVSghpxwzXWMVMVb5+hAXTo0bFXTnnZtzJt3Q /uwShFStvQQ9Z6qTzeIzRzWXOOL4X9fGmrfmSv2dMJ3HqQRYmKL1csKkrKnEUg+w1a1JaA WCp/6rg3eELuXvr34O9pWOkfyAE0bCZd/wDQG3eKrvPSJJxJfiP1AdfROSrmjCjd4VbDvp jsbNPuNECsK2Y0z5bBv0wf7hdV9M5auTSyr6VZQK6uHCKYHu/3EQNyNCNDiBiw== 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 4Rtmnp6T3FznsW; Sun, 24 Sep 2023 13:19:58 +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 38ODJwtk079849; Sun, 24 Sep 2023 13:19:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38ODJwmP079846; Sun, 24 Sep 2023 13:19:58 GMT (envelope-from git) Date: Sun, 24 Sep 2023 13:19:58 GMT Message-Id: <202309241319.38ODJwmP079846@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: 9b12f3763f24 - stable/14 - axge: Skip dummy packet headers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/14 X-Git-Reftype: branch X-Git-Commit: 9b12f3763f2463732b4353ebd000ecb34d3f6322 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9b12f3763f2463732b4353ebd000ecb34d3f6322 commit 9b12f3763f2463732b4353ebd000ecb34d3f6322 Author: Damien Broka AuthorDate: 2023-09-13 08:23:47 +0000 Commit: Ed Maste CommitDate: 2023-09-24 13:18:06 +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 a3b459a553e0..385a982afd9d 100644 --- a/sys/dev/usb/net/if_axge.c +++ b/sys/dev/usb/net/if_axge.c @@ -959,8 +959,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 @@ -968,6 +976,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 */ @@ -978,6 +990,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; @@ -989,7 +1007,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); } }