]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnxt_en: Add hardware NTUPLE filter for encapsulated packets.
authorMichael Chan <michael.chan@broadcom.com>
Mon, 13 Feb 2017 00:18:14 +0000 (19:18 -0500)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 6 Mar 2017 21:35:38 +0000 (13:35 -0800)
Orabug: 25645429

If skb_flow_dissect_flow_keys() returns with the encapsulation flag
set, pass the information to the firmware to setup the NTUPLE filter
accordingly.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 61aad724ec0a685bc83b02b059a3ca0ad3bde6b0)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/net/ethernet/broadcom/bnxt/bnxt.c

drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 833be54d7126eb3d09e273fa1b867a52c32755a3..53d7db3534210a1e58231916004845e7f4251391 100644 (file)
@@ -3432,6 +3432,9 @@ static int bnxt_hwrm_cfa_ntuple_filter_free(struct bnxt *bp,
         CFA_NTUPLE_FILTER_ALLOC_REQ_ENABLES_DST_PORT_MASK |    \
         CFA_NTUPLE_FILTER_ALLOC_REQ_ENABLES_DST_ID)
 
+#define BNXT_NTP_TUNNEL_FLTR_FLAG                              \
+               CFA_NTUPLE_FILTER_ALLOC_REQ_ENABLES_TUNNEL_TYPE
+
 static int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp,
                                             struct bnxt_ntuple_filter *fltr)
 {
@@ -3473,6 +3476,11 @@ static int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp,
                req.dst_ipaddr[0] = keys->addrs.v4addrs.dst;
                req.dst_ipaddr_mask[0] = cpu_to_be32(0xffffffff);
        }
+       if (keys->control.flags & FLOW_DIS_ENCAPSULATION) {
+               req.enables |= cpu_to_le32(BNXT_NTP_TUNNEL_FLTR_FLAG);
+               req.tunnel_type =
+                       CFA_NTUPLE_FILTER_ALLOC_REQ_TUNNEL_TYPE_ANYTUNNEL;
+       }
 
        req.src_port = keys->ports.src;
        req.src_port_mask = cpu_to_be16(0xffff);
@@ -6871,6 +6879,7 @@ static bool bnxt_fltr_match(struct bnxt_ntuple_filter *f1,
            keys1->ports.ports == keys2->ports.ports &&
            keys1->basic.ip_proto == keys2->basic.ip_proto &&
            keys1->basic.n_proto == keys2->basic.n_proto &&
+           keys1->control.flags == keys2->control.flags &&
            ether_addr_equal(f1->src_mac_addr, f2->src_mac_addr) &&
            ether_addr_equal(f1->dst_mac_addr, f2->dst_mac_addr))
                return true;
@@ -6910,9 +6919,6 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
        int rc = 0, idx, bit_id, l2_idx = 0;
        struct hlist_head *head;
 
-       if (skb->encapsulation)
-               return -EPROTONOSUPPORT;
-
        if (!ether_addr_equal(dev->dev_addr, eth->h_dest)) {
                struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
                int off = 0, j;
@@ -6976,6 +6982,12 @@ static int bnxt_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb,
                rc = -EPROTONOSUPPORT;
                goto err_free;
        }
+
+       if ((fkeys->control.flags & FLOW_DIS_ENCAPSULATION) &&
+           bp->hwrm_spec_code < 0x10601) {
+               rc = -EPROTONOSUPPORT;
+               goto err_free;
+       }
 #endif
 
        memcpy(new_fltr->dst_mac_addr, eth->h_dest, ETH_ALEN);