From: Michael Chan <michael.chan@broadcom.com>
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 <vikas.gupta@broadcom.com>
Subject: [PATCH net-next 06/13] bnxt_en: Add drop action support for ntuple
Date: Mon, 5 Feb 2024 14:31:55 -0800 [thread overview]
Message-ID: <20240205223202.25341-7-michael.chan@broadcom.com> (raw)
In-Reply-To: <20240205223202.25341-1-michael.chan@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 2709 bytes --]
From: Vikas Gupta <vikas.gupta@broadcom.com>
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 <andrew.gospodarek@broadcom.com>
Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
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)
--
2.30.1
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
next prev parent reply other threads:[~2024-02-05 22:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 22:31 [PATCH net-next 00/13] bnxt_en: Ntuple and RSS updates Michael Chan
2024-02-05 22:31 ` [PATCH net-next 01/13] bnxt_en: Use firmware provided maximum filter counts Michael Chan
2024-02-06 6:55 ` Michal Swiatkowski
2024-02-05 22:31 ` [PATCH net-next 02/13] bnxt_en: Add ethtool -N support for ether filters Michael Chan
2024-02-06 7:04 ` Michal Swiatkowski
2024-02-06 8:10 ` Michael Chan
2024-02-06 13:45 ` Michal Swiatkowski
2024-02-05 22:31 ` [PATCH net-next 03/13] bnxt_en: Support ethtool -n to display " Michael Chan
2024-02-06 7:15 ` Michal Swiatkowski
2024-02-05 22:31 ` [PATCH net-next 04/13] bnxt_en: implement fully specified 5-tuple masks Michael Chan
2024-02-06 7:47 ` Michal Swiatkowski
2024-02-05 22:31 ` [PATCH net-next 05/13] bnxt_en: Enhance ethtool ntuple support for ip flows besides TCP/UDP Michael Chan
2024-02-05 22:31 ` Michael Chan [this message]
2024-02-05 22:31 ` [PATCH net-next 07/13] bnxt_en: Add separate function to delete the filter structure Michael Chan
2024-02-05 22:31 ` [PATCH net-next 08/13] bnxt_en: Save user configured filters in a lookup list Michael Chan
2024-02-05 22:31 ` [PATCH net-next 09/13] bnxt_en: Retain user configured filters when closing Michael Chan
2024-02-05 22:31 ` [PATCH net-next 10/13] bnxt_en: Restore all the user created L2 and ntuple filters Michael Chan
2024-02-05 22:32 ` [PATCH net-next 11/13] bnxt_en: Add support for user configured RSS key Michael Chan
2024-02-05 22:32 ` [PATCH net-next 12/13] bnxt_en: Invalidate user filters when needed Michael Chan
2024-02-05 22:32 ` [PATCH net-next 13/13] bnxt_en: Add RSS support for IPSEC headers Michael Chan
2024-02-09 20:50 ` [PATCH net-next 00/13] bnxt_en: Ntuple and RSS updates patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240205223202.25341-7-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=vikas.gupta@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).