bnxt_en: Use the new VNIC to create ntuple filters
authorPavan Chebbi <pavan.chebbi@broadcom.com>
Tue, 20 Feb 2024 23:03:17 +0000 (15:03 -0800)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 22 Feb 2024 14:31:23 +0000 (15:31 +0100)
The newly created vnic (BNXT_VNIC_NTUPLE) is ready to be used to create
ntuple filters when supported by firmware.  All RX rings can be used
regardless of the RSS indirection setting on the default VNIC.

Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index b8ef6c2ba40c7fabb21386c99e183408d507fd40..9968d67e6c77f46f4238dc54dfdef7a80ea17d65 100644 (file)
@@ -5785,6 +5785,29 @@ void bnxt_fill_ipv6_mask(__be32 mask[4])
                mask[i] = cpu_to_be32(~0);
 }
 
+static void
+bnxt_cfg_rfs_ring_tbl_idx(struct bnxt *bp,
+                         struct hwrm_cfa_ntuple_filter_alloc_input *req,
+                         u16 rxq)
+{
+       if (BNXT_SUPPORTS_NTUPLE_VNIC(bp)) {
+               struct bnxt_vnic_info *vnic;
+               u32 enables;
+
+               vnic = &bp->vnic_info[BNXT_VNIC_NTUPLE];
+               req->dst_id = cpu_to_le16(vnic->fw_vnic_id);
+               enables = CFA_NTUPLE_FILTER_ALLOC_REQ_ENABLES_RFS_RING_TBL_IDX;
+               req->enables |= cpu_to_le32(enables);
+               req->rfs_ring_tbl_idx = cpu_to_le16(rxq);
+       } else {
+               u32 flags;
+
+               flags = CFA_NTUPLE_FILTER_ALLOC_REQ_FLAGS_DEST_RFS_RING_IDX;
+               req->flags |= cpu_to_le32(flags);
+               req->dst_id = cpu_to_le16(rxq);
+       }
+}
+
 int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp,
                                      struct bnxt_ntuple_filter *fltr)
 {
@@ -5794,7 +5817,6 @@ int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp,
        struct flow_keys *keys = &fltr->fkeys;
        struct bnxt_l2_filter *l2_fltr;
        struct bnxt_vnic_info *vnic;
-       u32 flags = 0;
        int rc;
 
        rc = hwrm_req_init(bp, req, HWRM_CFA_NTUPLE_FILTER_ALLOC);
@@ -5805,16 +5827,15 @@ int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp,
        req->l2_filter_id = l2_fltr->base.filter_id;
 
        if (fltr->base.flags & BNXT_ACT_DROP) {
-               flags = CFA_NTUPLE_FILTER_ALLOC_REQ_FLAGS_DROP;
+               req->flags =
+                       cpu_to_le32(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);
+               bnxt_cfg_rfs_ring_tbl_idx(bp, req, fltr->base.rxq);
        } else {
                vnic = &bp->vnic_info[fltr->base.rxq + 1];
                req->dst_id = cpu_to_le16(vnic->fw_vnic_id);
        }
-       req->flags = cpu_to_le32(flags);
-       req->enables = cpu_to_le32(BNXT_NTP_FLTR_FLAGS);
+       req->enables |= cpu_to_le32(BNXT_NTP_FLTR_FLAGS);
 
        req->ethertype = htons(ETH_P_IP);
        req->ip_addr_type = CFA_NTUPLE_FILTER_ALLOC_REQ_IP_ADDR_TYPE_IPV4;