Add support for creating PPPoE filters in switchdev mode. Add support
for parsing PPPoE and PPP-specific tc options: pppoe_sid and ppp_proto.

Signed-off-by: Marcin Szycik <marcin.szy...@linux.intel.com>
Signed-off-by: Lukasz Plachno <lukasz.plac...@intel.com>
Signed-off-by: Qiming Yang <qiming.y...@intel.com>
---
 drivers/net/ice/base/ice_bitops.h |  2 +-
 drivers/net/ice/base/ice_ddp.c    |  4 ++-
 drivers/net/ice/base/ice_switch.c | 46 +++++++++++++++++++++++--------
 3 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ice/base/ice_bitops.h 
b/drivers/net/ice/base/ice_bitops.h
index df00c859ac..3b71c1b7f5 100644
--- a/drivers/net/ice/base/ice_bitops.h
+++ b/drivers/net/ice/base/ice_bitops.h
@@ -433,7 +433,7 @@ ice_bitmap_hweight(ice_bitmap_t *bm, u16 size)
 }
 
 /**
- * ice_cmp_bitmaps - compares two bitmaps.
+ * ice_cmp_bitmap - compares two bitmaps.
  * @bmp1: the bitmap to compare
  * @bmp2: the bitmap to compare with bmp1
  * @size: Size of the bitmaps in bits
diff --git a/drivers/net/ice/base/ice_ddp.c b/drivers/net/ice/base/ice_ddp.c
index 93ff2608d4..3e18f2bc70 100644
--- a/drivers/net/ice/base/ice_ddp.c
+++ b/drivers/net/ice/base/ice_ddp.c
@@ -1623,8 +1623,10 @@ ice_get_sw_fv_list(struct ice_hw *hw, struct 
ice_prot_lkup_ext *lkups,
                        }
                }
        } while (fv);
-       if (LIST_EMPTY(fv_list))
+       if (LIST_EMPTY(fv_list)) {
+               ice_warn(hw, "Required profiles not found in currently loaded 
DDP package");
                return ICE_ERR_CFG;
+       }
        return ICE_SUCCESS;
 
 err:
diff --git a/drivers/net/ice/base/ice_switch.c 
b/drivers/net/ice/base/ice_switch.c
index a9f3ae5bf5..e290a845bc 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -1775,7 +1775,7 @@ static const u8 dummy_pppoe_ipv6_packet[] = {
 };
 
 static const
-struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv6_tcp_offsets[] = {
+struct ice_dummy_pkt_offsets dummy_pppoe_ipv6_tcp_packet_offsets[] = {
        { ICE_MAC_OFOS,         0 },
        { ICE_VLAN_OFOS,        12 },
        { ICE_ETYPE_OL,         16 },
@@ -1820,7 +1820,7 @@ static const u8 dummy_pppoe_ipv6_tcp_packet[] = {
 };
 
 static const
-struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv6_udp_offsets[] = {
+struct ice_dummy_pkt_offsets dummy_pppoe_ipv6_udp_packet_offsets[] = {
        { ICE_MAC_OFOS,         0 },
        { ICE_VLAN_OFOS,        12 },
        { ICE_ETYPE_OL,         16 },
@@ -8291,7 +8291,7 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, 
u16 lkups_cnt,
                      const struct ice_dummy_pkt_offsets **offsets)
 {
        bool tcp = false, udp = false, outer_ipv6 = false, vlan = false;
-       bool inner_ipv6 = false;
+       bool inner_ipv6 = false, pppoe = false;
        bool cvlan = false;
        bool gre = false, mpls = false;
        u16 i;
@@ -8321,18 +8321,20 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, 
u16 lkups_cnt,
                         lkups[i].m_u.ethertype.ethtype_id ==
                                CPU_TO_BE16(0xFFFF))
                        inner_ipv6 = true;
+               else if (lkups[i].type == ICE_PPPOE) {
+                       pppoe = true;
+                       if (lkups[i].h_u.pppoe_hdr.ppp_prot_id ==
+                               CPU_TO_BE16(ICE_PPP_IPV6_PROTO_ID) &&
+                           lkups[i].m_u.pppoe_hdr.ppp_prot_id ==
+                               CPU_TO_BE16(0xFFFF))
+                               outer_ipv6 = true;
+               }
                else if (lkups[i].type == ICE_IPV4_OFOS &&
                         lkups[i].h_u.ipv4_hdr.protocol ==
                                ICE_IPV4_NVGRE_PROTO_ID &&
                         lkups[i].m_u.ipv4_hdr.protocol ==
                                0xFF)
                        gre = true;
-               else if (lkups[i].type == ICE_PPPOE &&
-                        lkups[i].h_u.pppoe_hdr.ppp_prot_id ==
-                               CPU_TO_BE16(ICE_PPP_IPV6_PROTO_ID) &&
-                        lkups[i].m_u.pppoe_hdr.ppp_prot_id ==
-                               0xFFFF)
-                       outer_ipv6 = true;
                else if (lkups[i].type == ICE_IPV4_IL &&
                         lkups[i].h_u.ipv4_hdr.protocol ==
                                ICE_TCP_PROTO_ID &&
@@ -8627,14 +8629,14 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, 
u16 lkups_cnt,
        if (tun_type == ICE_SW_TUN_PPPOE_IPV6_TCP) {
                *pkt = dummy_pppoe_ipv6_tcp_packet;
                *pkt_len = sizeof(dummy_pppoe_ipv6_tcp_packet);
-               *offsets = dummy_pppoe_packet_ipv6_tcp_offsets;
+               *offsets = dummy_pppoe_ipv6_tcp_packet_offsets;
                return;
        }
 
        if (tun_type == ICE_SW_TUN_PPPOE_IPV6_UDP) {
                *pkt = dummy_pppoe_ipv6_udp_packet;
                *pkt_len = sizeof(dummy_pppoe_ipv6_udp_packet);
-               *offsets = dummy_pppoe_packet_ipv6_udp_offsets;
+               *offsets = dummy_pppoe_ipv6_udp_packet_offsets;
                return;
        }
 
@@ -8738,6 +8740,11 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, 
u16 lkups_cnt,
                        *pkt_len = sizeof(dummy_vlan_udp_packet);
                        *offsets = dummy_vlan_udp_packet_offsets;
                        return;
+               } else if (pppoe) {
+                       *pkt = dummy_pppoe_ipv4_udp_packet;
+                       *pkt_len = sizeof(dummy_pppoe_ipv4_udp_packet);
+                       *offsets = dummy_pppoe_ipv4_udp_packet_offsets;
+                       return;
                }
                *pkt = dummy_udp_packet;
                *pkt_len = sizeof(dummy_udp_packet);
@@ -8749,6 +8756,11 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, 
u16 lkups_cnt,
                        *pkt_len = sizeof(dummy_vlan_udp_ipv6_packet);
                        *offsets = dummy_vlan_udp_ipv6_packet_offsets;
                        return;
+               } else if (pppoe) {
+                       *pkt = dummy_pppoe_ipv6_udp_packet;
+                       *pkt_len = sizeof(dummy_pppoe_ipv6_udp_packet);
+                       *offsets = dummy_pppoe_ipv6_udp_packet_offsets;
+                       return;
                }
                *pkt = dummy_udp_ipv6_packet;
                *pkt_len = sizeof(dummy_udp_ipv6_packet);
@@ -8760,6 +8772,11 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, 
u16 lkups_cnt,
                        *pkt_len = sizeof(dummy_vlan_tcp_ipv6_packet);
                        *offsets = dummy_vlan_tcp_ipv6_packet_offsets;
                        return;
+               } else if (pppoe) {
+                       *pkt = dummy_pppoe_ipv6_tcp_packet;
+                       *pkt_len = sizeof(dummy_pppoe_ipv6_tcp_packet);
+                       *offsets = dummy_pppoe_ipv6_tcp_packet_offsets;
+                       return;
                }
                *pkt = dummy_tcp_ipv6_packet;
                *pkt_len = sizeof(dummy_tcp_ipv6_packet);
@@ -8771,7 +8788,12 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, 
u16 lkups_cnt,
                *pkt = dummy_vlan_tcp_packet;
                *pkt_len = sizeof(dummy_vlan_tcp_packet);
                *offsets = dummy_vlan_tcp_packet_offsets;
-       }  else if (mpls) {
+       } else if (pppoe) {
+               *pkt = dummy_pppoe_ipv4_tcp_packet;
+               *pkt_len = sizeof(dummy_pppoe_ipv4_tcp_packet);
+               *offsets = dummy_pppoe_ipv4_tcp_packet_offsets;
+               return;
+       } else if (mpls) {
                *pkt = dummy_mpls_packet;
                *pkt_len = sizeof(dummy_mpls_packet);
                *offsets = dummy_mpls_packet_offsets;
-- 
2.25.1

Reply via email to