From patchwork Mon Feb 5 22:31:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13546348 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4978D487A5 for ; Mon, 5 Feb 2024 22:32:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172346; cv=none; b=D+I707m7Ll2Ll3WWTKQDCDlc3Jh5X/RI1Nc/XT+IvzSeCnSfo6LxKqoKgENkSdMYdphttseiAi7GKbdg3A6193y65KVlMy6Vvs6Pp/N2J60xZ7i3PqT5KJiO1cxqB9nskYhM9baQbwKx9UBulP+t83aFUDCQ0PpStQdvksh6Lv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707172346; c=relaxed/simple; bh=+IVAGghXC7MDXjB3JRyq6K7+RKDv7KlY4g+ID0BAVrI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=MTmmhcuPBfCgOc3vU6Q844f1eDnnyXYDySkjIjTyfDGKH9oPDenF3bqLC+39ekvZdfYk+7BIvlWQlo2iG2q1KAN7nj4QXHasbj2ydITllV/9FLwQBA2QdNDrUjujfUhZGse1C3tOL3eZ+EbOzndcBgNUVh0ycJC0sfJJd4/33Zg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Q79EjVOF; arc=none smtp.client-ip=209.85.210.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Q79EjVOF" Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-6e12b58a3beso100781a34.1 for ; Mon, 05 Feb 2024 14:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1707172344; x=1707777144; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=gbPvw9NEMjt40TQEUkS4b8CFQKhnAMhrkFnx4+gMy38=; b=Q79EjVOF4PVkGS+Fxd/g/q1G1P/rrB90cHoIMq6Aflw9j6LYgc6rAyhY2BBhX3c8ne hjbHgbEuje2KKs83j4fcAX56GZ+OitH07btFfhH+mX+HoSchhYogUirb0RE+gSO/ds4l tPnE5jUfE/FVlCbF+jkeR2dy2vua8YknsJXYU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707172344; x=1707777144; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gbPvw9NEMjt40TQEUkS4b8CFQKhnAMhrkFnx4+gMy38=; b=OZ6fdepoj9wo33oFkhGNqoMYjWXR1FQBLwINYRYMjptiyTjWd8ET4g3T6WIbp1eONj DWtlMQNx2RvOCOGre5+2jepJuCF3eAd8wqCInaZcGTi2o3zm04VTfz6rEbtNJHqwBsLv sAL1M9Pf/hzlYIu0Sd5N2NAIU3mSUB6PyZteXComOTticvyQgk4C1CpJw76+jeJHpnF1 TRPGF29XnFnNHs4H3BSwhSkVh8ejbboWH2jcvoXDgxc7RHBfLo0gG5ut+ZmbWqewhSYo ALWgOzzcKNwuu5PIJhS1LzbkAXhwcjHlRf7fsR4Rn1HNRnI4OFPGIeMgtQrcJtdKrVu/ d1Aw== X-Gm-Message-State: AOJu0Yz2/jbvsTCLlLx747EAj/ycG9boV273/Z5b+GJV8eMdCjMUlQfY fVKq/sUeQcCYswylSMnqSCEsU5DhiGGMWYB4QFQGs5qYetEUU67uPUTpsTO71Q== X-Google-Smtp-Source: AGHT+IFiTFezWmwgR07k6zz1TVfWr9+veXWPpDd/aTxi92MiS8lUdMjGHjqsUtmIFkp1L+Od4xPsdA== X-Received: by 2002:a05:6830:22f3:b0:6e2:7941:f62f with SMTP id t19-20020a05683022f300b006e27941f62fmr927769otc.31.1707172344210; Mon, 05 Feb 2024 14:32:24 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVtwb3z/Zee+xQ32Ck5WrLfR1yVxJAb6U8eM+fq8oFp5/22tLXuGp1u+0HzNMmw1HDh9+TdskXL56ASIj5c5MdQzQJkIBr4rcwgcKKxBQMF4zTxDialbTLEiQE0nw13PFmuLzZcPK+/g9Ve0O5fYBBflv4Fm8t0LPwEytVIC0rezr2HHkBTDtN6nyHE+BDoV8nU0T/hX5FBqlpO9yCeF3khtdNhIu7VFsEbyInhXOz/3l7mcYq/1af3qZHvdg== Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id x11-20020ac8120b000000b0042c2d47d7fbsm340864qti.60.2024.02.05.14.32.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Feb 2024 14:32:23 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew.gospodarek@broadcom.com, pavan.chebbi@broadcom.com, Vikas Gupta Subject: [PATCH net-next 06/13] bnxt_en: Add drop action support for ntuple Date: Mon, 5 Feb 2024 14:31:55 -0800 Message-Id: <20240205223202.25341-7-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20240205223202.25341-1-michael.chan@broadcom.com> References: <20240205223202.25341-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Vikas Gupta Add drop action for protocols TCP/UDP/ICMP 1) Drop action for TCP/UDP is supported via flow type tcp4/udp4/tcp6/udp6. 2) Drop action for ICMPV4/ICMPV6/wildcard is supported via flow type ipv4/ipv6. Reviewed-by: Andy Gospodarek Signed-off-by: Vikas Gupta Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 +++-- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index ea9c33e328cf..382b4a559c9c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -5747,8 +5747,9 @@ int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp, l2_fltr = fltr->l2_fltr; req->l2_filter_id = l2_fltr->base.filter_id; - - if (bp->fw_cap & BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX_V2) { + if (fltr->base.flags & BNXT_ACT_DROP) { + flags = CFA_NTUPLE_FILTER_ALLOC_REQ_FLAGS_DROP; + } else if (bp->fw_cap & BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX_V2) { flags = CFA_NTUPLE_FILTER_ALLOC_REQ_FLAGS_DEST_RFS_RING_IDX; req->dst_id = cpu_to_le16(fltr->base.rxq); } else { diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index b6bc14b5d1bb..6721c4a88453 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1192,7 +1192,10 @@ static int bnxt_grxclsrule(struct bnxt *bp, struct ethtool_rxnfc *cmd) } } - fs->ring_cookie = fltr->base.rxq; + if (fltr->base.flags & BNXT_ACT_DROP) + fs->ring_cookie = RX_CLS_FLOW_DISC; + else + fs->ring_cookie = fltr->base.rxq; rc = 0; fltr_err: @@ -1398,8 +1401,11 @@ static int bnxt_add_ntuple_cls_rule(struct bnxt *bp, } rcu_read_unlock(); - new_fltr->base.rxq = ring; new_fltr->base.flags = BNXT_ACT_NO_AGING; + if (fs->ring_cookie == RX_CLS_FLOW_DISC) + new_fltr->base.flags |= BNXT_ACT_DROP; + else + new_fltr->base.rxq = ring; __set_bit(BNXT_FLTR_VALID, &new_fltr->base.state); rc = bnxt_insert_ntp_filter(bp, new_fltr, idx); if (!rc) { @@ -1441,6 +1447,9 @@ static int bnxt_srxclsrlins(struct bnxt *bp, struct ethtool_rxnfc *cmd) return -EINVAL; flow_type &= ~FLOW_EXT; + if (fs->ring_cookie == RX_CLS_FLOW_DISC && flow_type != ETHER_FLOW) + return bnxt_add_ntuple_cls_rule(bp, fs); + ring = ethtool_get_flow_spec_ring(fs->ring_cookie); vf = ethtool_get_flow_spec_ring_vf(fs->ring_cookie); if (BNXT_VF(bp) && vf)