From nobody Wed Jan 24 12:36:54 2024 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 4TKk3p2M9Yz58BNH; Wed, 24 Jan 2024 12:36:54 +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 4TKk3p1v3Vz4Sk0; Wed, 24 Jan 2024 12:36:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706099814; 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=pOZ8H2zqwX4PgKoUm/gMkNiPWBGwqcm+aG6JkZ0xVhM=; b=MuydyEq3OM4sgZPlb8sw7CK3sg6PTwGoXA7LKvE1zzxIkFxUBOtBfjvg4w7Lzye3fhsHl/ b1o7SrlOhvJ7gUlB8JtlvbE2T1rdin1KYBpLMX5drPDB4U4+5CYYkEUhTsRbZYhNbsgA3I DE/4nFyxwr1/0T8itXMoXzffssjLJJuQITielvSh2Q9cmbgU7t0RwFE7Xno8YE/+kqGsWP B9QtsrKtt5r1ssNRtLqXvxlg9A8qXfQ1tYsv6j6UUZpEQ+5q5oELcL8RAj0yPyaccAkk0Y YAnkCUtGCHKnCLNYFTR39EKCEaQ5PF61nJXcWGo1cD6fQoWJ5aFCT1PldccqmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706099814; 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=pOZ8H2zqwX4PgKoUm/gMkNiPWBGwqcm+aG6JkZ0xVhM=; b=n2s7VsOzxEGqxdBITCBC+f4MTi36HlmGkcEFtpx89kYgzBZKEbyBgqGxl/BNvRYk2VGNcb d6gkTMvdMZjHwFRSp00zLy8hOuYvYHZsvNwM8h31gh2nzfA62kwMGE0pJFsOf6+2VzCYSy V/niAsUIzoHOW9wxYYt3ry59Cjt7B8SqvOihT+wDyGGzGrBY9Zcf7MKV+YEWvHe6pvjonm AmfNIcaT5pLJ+605M1pCiA6GZ/jwACjDcgSENZ9ArDssY1ha19m4U6ioQQlu+LwUtRkuKM ONZOkE159UlIsDdzySQ5zZ9P6mZSJEIvUI5BrOk1o0VCEh3hxpC5XRrbv0ORUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706099814; a=rsa-sha256; cv=none; b=tZX6GUgRbvJzbBVMErd/Y/hNdW90WVnRcgqrJEBKeaI2eaJvk+83dImWiWS2JWDDxCRkG9 bbT+EyJ3Q2HtE8Gxkk+Teh0+72UbYMEdU0VQKWUA7wGYaAL4AZ0qC8E/DHiOF3gGS+Zfh5 KOS5tq2KmbmVx6UGymzEA9LeCW0fYo3KpIkGgel6j4BbOP+y0bnuNP2QCzdTDDwletSGAn K9cAXyIZn66VkJ/DX6LFf0ZSVyvwEN9EQEoTVoyZs9w7HDadb0gG3OywBmvGE6oib3a/Lt iOB5piz69IpdTnoZFRMlbuI3ADs/CT9vLIf1312A/9FuXMtKBUeUO3oVJX83Kg== 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 4TKk3p0yJlzF85; Wed, 24 Jan 2024 12:36:54 +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 40OCasMb082051; Wed, 24 Jan 2024 12:36:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40OCasuj082048; Wed, 24 Jan 2024 12:36:54 GMT (envelope-from git) Date: Wed, 24 Jan 2024 12:36:54 GMT Message-Id: <202401241236.40OCasuj082048@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 33cd6211052c - stable/14 - mana: Fix TX CQE error handling 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: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 33cd6211052c5add833150b2eff1bc0729651d3a Auto-Submitted: auto-generated The branch stable/14 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=33cd6211052c5add833150b2eff1bc0729651d3a commit 33cd6211052c5add833150b2eff1bc0729651d3a Author: Wei Hu AuthorDate: 2024-01-17 09:19:35 +0000 Commit: Wei Hu CommitDate: 2024-01-24 12:36:13 +0000 mana: Fix TX CQE error handling For an unknown TX CQE error type (probably from a newer hardware), still free the mbuf, update the queue tail, etc., otherwise the accounting will be wrong. Also, TX errors can be triggered by injecting corrupted packets, so replace the mana_err to mana_dbg logging. Reported by: NetApp MFC after: 1 week Sponsored by: Microsoft (cherry picked from commit 516b5059705b6b8bbba28821dbe05964c128f9a9) --- sys/dev/mana/mana.h | 2 ++ sys/dev/mana/mana_en.c | 14 ++++++++------ sys/dev/mana/mana_sysctl.c | 6 ++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/dev/mana/mana.h b/sys/dev/mana/mana.h index ab394f3203ad..906b28eb56b6 100644 --- a/sys/dev/mana/mana.h +++ b/sys/dev/mana/mana.h @@ -137,6 +137,8 @@ struct mana_stats { counter_u64_t mbuf_alloc_fail; /* rx */ counter_u64_t alt_chg; /* tx */ counter_u64_t alt_reset; /* tx */ + counter_u64_t cqe_err; /* tx */ + counter_u64_t cqe_unknown_type; /* tx */ }; struct mana_txq { diff --git a/sys/dev/mana/mana_en.c b/sys/dev/mana/mana_en.c index 812a42e51dfc..09de49a11010 100644 --- a/sys/dev/mana/mana_en.c +++ b/sys/dev/mana/mana_en.c @@ -1487,21 +1487,23 @@ mana_poll_tx_cq(struct mana_cq *cq) case CQE_TX_VPORT_DISABLED: case CQE_TX_VLAN_TAGGING_VIOLATION: sa_drop ++; - mana_err(NULL, + mana_dbg(NULL, "TX: txq %d CQE error %d, ntc = %d, " "pending sends = %d: err ignored.\n", txq_idx, cqe_oob->cqe_hdr.cqe_type, next_to_complete, txq->pending_sends); + counter_u64_add(txq->stats.cqe_err, 1); break; default: - /* If the CQE type is unexpected, log an error, - * and go through the error path. + /* If the CQE type is unknown, log a debug msg, + * and still free the mbuf, etc. */ - mana_err(NULL, - "ERROR: TX: Unexpected CQE type %d: HW BUG?\n", + mana_dbg(NULL, + "ERROR: TX: Unknown CQE type %d\n", cqe_oob->cqe_hdr.cqe_type); - return; + counter_u64_add(txq->stats.cqe_unknown_type, 1); + break; } if (txq->gdma_txq_id != completions[i].wq_num) { mana_dbg(NULL, diff --git a/sys/dev/mana/mana_sysctl.c b/sys/dev/mana/mana_sysctl.c index d03ebe44ab31..844a05040595 100644 --- a/sys/dev/mana/mana_sysctl.c +++ b/sys/dev/mana/mana_sysctl.c @@ -292,6 +292,12 @@ mana_sysctl_add_queues(struct mana_port_context *apc) SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO, "alt_reset", CTLFLAG_RD, &tx_stats->alt_reset, "Reset to self txq"); + SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO, + "cqe_err", CTLFLAG_RD, + &tx_stats->cqe_err, "Error CQE count"); + SYSCTL_ADD_COUNTER_U64(ctx, tx_list, OID_AUTO, + "cqe_unknown_type", CTLFLAG_RD, + &tx_stats->cqe_unknown_type, "Unknown CQE count"); /* RX stats */ rx_node = SYSCTL_ADD_NODE(ctx, queue_list, OID_AUTO,