]> git.droids-corp.org - dpdk.git/commitdiff
net/mvpp2: support forwarding bad packets
authorDana Vardi <danat@marvell.com>
Wed, 27 Jan 2021 16:09:46 +0000 (18:09 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:11 +0000 (18:16 +0100)
Extend the config file with option to forward packets
that were marked as "l2 bad pkts".
By default the driver drop those packets

Signed-off-by: Dana Vardi <danat@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
doc/guides/nics/mvpp2.rst
drivers/net/mvpp2/mrvl_ethdev.c
drivers/net/mvpp2/mrvl_ethdev.h
drivers/net/mvpp2/mrvl_qos.c
drivers/net/mvpp2/mrvl_qos.h

index 354a2016c7bf7fd2c2faa4edb2ca7d4ab5abea5a..5cdd8f4bbe101ae1a29ff709360e1ff232848fb7 100644 (file)
@@ -217,6 +217,7 @@ Configuration syntax
 
    [port <portnum> default]
    start_hdr = <start_hdr>
+   forward_bad_frames = <forward_bad_frames>
    default_tc = <default_tc>
    mapping_priority = <mapping_priority>
 
@@ -263,6 +264,8 @@ Where:
 
 - ``<start_hdr>``: Indicate what is the start header mode (`none` (eth), `dsa`, `ext_dsa` or `custom`).
 
+- ``<forward_bad_frames>``: Indicate whether to forward or drop l2 bad packets (0 or 1).
+
 - ``<default_tc>``: Default traffic class (e.g. 0)
 
 - ``<mapping_priority>``: QoS priority for mapping (`ip`, `vlan`, `ip/vlan` or `vlan/ip`).
index 7263a7ec3c222a0948d8569a722de0aa3ccbf7d6..0c32037fe57455ad668c30e48cf47b07bdff9c9c 100644 (file)
@@ -813,9 +813,14 @@ mrvl_dev_start(struct rte_eth_dev *dev)
                 priv->pp_id, priv->ppio_id);
        priv->ppio_params.match = match;
        priv->ppio_params.eth_start_hdr = PP2_PPIO_HDR_ETH;
-       if (mrvl_cfg)
+       priv->forward_bad_frames = 0;
+
+       if (mrvl_cfg) {
                priv->ppio_params.eth_start_hdr =
                        mrvl_cfg->port[dev->data->port_id].eth_start_hdr;
+               priv->forward_bad_frames =
+                       mrvl_cfg->port[dev->data->port_id].forward_bad_frames;
+       }
 
        /*
         * Calculate the minimum bpool size for refill feature as follows:
@@ -2622,7 +2627,8 @@ mrvl_rx_pkt_burst(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
                /* drop packet in case of mac, overrun or resource error */
                status = pp2_ppio_inq_desc_get_l2_pkt_error(&descs[i]);
-               if (unlikely(status != PP2_DESC_ERR_OK)) {
+               if ((unlikely(status != PP2_DESC_ERR_OK)) &&
+                       !(q->priv->forward_bad_frames)) {
                        struct pp2_buff_inf binf = {
                                .addr = rte_mbuf_data_iova_default(mbuf),
                                .cookie = (uint64_t)mbuf,
index 0ee7208fbd6b30fa6109a97015777a5de475d7d4..8d5469c9d4c3606eb06c44c5cf345fa9b11c6d65 100644 (file)
@@ -181,6 +181,8 @@ struct mrvl_priv {
        LIST_HEAD(shaper_profiles, mrvl_tm_shaper_profile) shaper_profiles;
        LIST_HEAD(nodes, mrvl_tm_node) nodes;
        uint64_t rate_max;
+
+       uint8_t forward_bad_frames;
 };
 
 /** Flow operations forward declaration. */
index 9fec3c1566525ffc5f2946a4217738641104c54e..38556b228bfbc7f2c7bc658e375c62a8f7e05f2c 100644 (file)
@@ -76,6 +76,8 @@
 #define MRVL_TOK_PARSER_UDF_PROTO_UDP "udp"
 #define MRVL_TOK_PARSER_UDF_FIELD_UDP_DPORT "dport"
 
+/* parser forward bad frames tokens */
+#define MRVL_TOK_FWD_BAD_FRAMES "forward_bad_frames"
 
 /** Number of tokens in range a-b = 2. */
 #define MAX_RNG_TOKENS 2
@@ -872,6 +874,21 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
                                return -1;
                        }
                }
+
+               /* Parse forward bad frames option */
+               entry = rte_cfgfile_get_entry(file, sec_name,
+                               MRVL_TOK_FWD_BAD_FRAMES);
+               if (entry) {
+                       if (get_val_securely(entry, &val) < 0) {
+                               MRVL_LOG(ERR,
+                                       "Error in parsing %s value (%s)!\n",
+                                       MRVL_TOK_FWD_BAD_FRAMES, entry);
+                               return -1;
+                       }
+                       (*cfg)->port[n].forward_bad_frames = (uint8_t)val;
+               } else {
+                       (*cfg)->port[n].forward_bad_frames = 0;
+               }
        }
 
        return 0;
index daf4776ecdbc06a355a78bb691e7e106f6dd0974..f2e341c372dc12542b3bf94fc9fe306ed9586682 100644 (file)
@@ -48,6 +48,7 @@ struct mrvl_cfg {
                uint8_t use_global_defaults;
                struct pp2_cls_plcr_params policer_params;
                uint8_t setup_policer;
+               uint8_t forward_bad_frames;
        } port[RTE_MAX_ETHPORTS];
 };