From nobody Wed Sep 13 15:21:55 2023 X-Original-To: dev-commits-src-main@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 4Rm41b3xgbz4spmR; Wed, 13 Sep 2023 15:21:55 +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 4Rm41b3WCXz3LXb; Wed, 13 Sep 2023 15:21:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694618515; 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=YNYEiq16GjwIoHI0AuwNxucNNjKHbLJElKywWrwC2Lk=; b=E7RvFS1FP93WH9oQHQ9AYGR9FYIxbj29C5YATBqxz55a/w6W1Pq9gd09K6Qts+aiF7PAlo KE4lJYq8OUwO/mQiyKMDn8A+S0Avt1RRWLziS8kIEi9oeF4PQ/h7d78mQ4FiUawLIQmlEs /SV+6+oysn4W/EskpW13dHvFzKzZx3rUVTxNdFlQ4JEjYGR7qbMlQqIKKQxvmJ9kbOOoP2 btKyexgMFaflsnttYX8V4ZopO9K7KIXsMfHaMC7CHG16waV/yjwOWu/IxuYli4O2/af+Vj 7jyAU0hRSpsrwdk3hQ5QLuvRgFlN5qJoAi9TMkgbkDygtEDNe2B2iKbBlUVgkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694618515; a=rsa-sha256; cv=none; b=el1rX179LhlLR/9j1HPksXEPG6QLUejo2uYnwvk5sY4duCz707mI/DoAuf6U/KsxU9bb7V drN8ZUuBjYLoZyCFQ9rVbagWlu0tSglhNFsWrNhmlXLYWMeu3dt7dkUW4s6L8WuwOQNkrw JkOr8Olv6R3QTlvJRt6bYt7K/f7qET6OWWGQ4PXBZ7Psr/ckyS39wex5oW1vf8dbZAYWH1 bvwdobr9FE0eYlqIKhFohbFQD+wJvYLvprR5XxEX0BI1pY0zuAcUE7LiTJy/ngEy8M0rC6 TlGuCbJG/Qtf1CXbIceU9COlXwTIeJr9yWIHgyPpaRRLCjwW51/bexxV8l7i+g== 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=1694618515; 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=YNYEiq16GjwIoHI0AuwNxucNNjKHbLJElKywWrwC2Lk=; b=Z62qxqYEY3t5emngmZrUTkTM0l1kfll+3EI14/6Cy6Aa24R3aX6hYrGHa+Wa88D+uvHJdO MYxXcIErxCeGP/LUmEGv+YDK59CS066GbXYaAkti98NgneKJ3uv3+NTjRbFrFmV1pEL0Oh +ZrgjfNTa+TM861EG0xhH8DG5F6MDEYARXW1b1VxJTbtisazFyirkCE2PGfObcSl5/VqzZ cyi6/MimGIMb88sAN6Qd/F4LjmAnw+dL7M8kEw163q9qGrRcQjOce2NaFjR8EJ9vHKzfT1 qNZXx54+D1GJz8CorIWg7SOb7z3y1QlK94JBpZP6ivXYAVcyY7FDjf6Qxj0ixw== 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 4Rm41b2d30z4jQ; Wed, 13 Sep 2023 15:21:55 +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 38DFLtBj029768; Wed, 13 Sep 2023 15:21:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38DFLtZg029765; Wed, 13 Sep 2023 15:21:55 GMT (envelope-from git) Date: Wed, 13 Sep 2023 15:21:55 GMT Message-Id: <202309131521.38DFLtZg029765@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 70fbcd451b68 - main - axge: Skip dummy packet headers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 70fbcd451b68b7f6038d8a602cd8d5e1bb890f1d Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=70fbcd451b68b7f6038d8a602cd8d5e1bb890f1d commit 70fbcd451b68b7f6038d8a602cd8d5e1bb890f1d Author: Damien Broka AuthorDate: 2023-09-13 08:23:47 +0000 Commit: Ed Maste CommitDate: 2023-09-13 14:08:11 +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 --- 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); } }