ethdev: replace callback getting filter operations
[dpdk.git] / drivers / net / mvpp2 / mrvl_ethdev.c
index 7263a7e..1d41788 100644 (file)
@@ -52,8 +52,6 @@
 #define MRVL_IFACE_NAME_ARG "iface"
 #define MRVL_CFG_ARG "cfg"
 
-#define MRVL_BURST_SIZE 64
-
 #define MRVL_ARP_LENGTH 28
 
 #define MRVL_COOKIE_ADDR_INVALID ~0ULL
@@ -813,9 +811,17 @@ 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;
+       priv->fill_bpool_buffs = MRVL_BURST_SIZE;
+
+       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;
+               priv->fill_bpool_buffs =
+                       mrvl_cfg->port[dev->data->port_id].fill_bpool_buffs;
+       }
 
        /*
         * Calculate the minimum bpool size for refill feature as follows:
@@ -900,7 +906,7 @@ mrvl_dev_start(struct rte_eth_dev *dev)
 
        /* For default QoS config, don't start classifier. */
        if (mrvl_cfg  &&
-           mrvl_cfg->port[dev->data->port_id].use_global_defaults == 0) {
+           mrvl_cfg->port[dev->data->port_id].use_qos_global_defaults == 0) {
                ret = mrvl_start_qos_mapping(priv);
                if (ret) {
                        MRVL_LOG(ERR, "Failed to setup QoS mapping");
@@ -2334,32 +2340,18 @@ mrvl_rss_hash_conf_get(struct rte_eth_dev *dev,
  *
  * @param dev
  *   Pointer to the device structure.
- * @param filer_type
- *   Flow filter type.
- * @param filter_op
- *   Flow filter operation.
- * @param arg
+ * @param ops
  *   Pointer to pass the flow ops.
  *
  * @return
  *   0 on success, negative error value otherwise.
  */
 static int
-mrvl_eth_filter_ctrl(struct rte_eth_dev *dev __rte_unused,
-                    enum rte_filter_type filter_type,
-                    enum rte_filter_op filter_op, void *arg)
+mrvl_eth_flow_ops_get(struct rte_eth_dev *dev __rte_unused,
+                     const struct rte_flow_ops **ops)
 {
-       switch (filter_type) {
-       case RTE_ETH_FILTER_GENERIC:
-               if (filter_op != RTE_ETH_FILTER_GET)
-                       return -EINVAL;
-               *(const void **)arg = &mrvl_flow_ops;
-               return 0;
-       default:
-               MRVL_LOG(WARNING, "Filter type (%d) not supported",
-                               filter_type);
-               return -EINVAL;
-       }
+       *ops = &mrvl_flow_ops;
+       return 0;
 }
 
 /**
@@ -2437,7 +2429,7 @@ static const struct eth_dev_ops mrvl_ops = {
        .flow_ctrl_set = mrvl_flow_ctrl_set,
        .rss_hash_update = mrvl_rss_hash_update,
        .rss_hash_conf_get = mrvl_rss_hash_conf_get,
-       .filter_ctrl = mrvl_eth_filter_ctrl,
+       .flow_ops_get = mrvl_eth_flow_ops_get,
        .mtr_ops_get = mrvl_mtr_ops_get,
        .tm_ops_get = mrvl_tm_ops_get,
 };
@@ -2622,7 +2614,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,
@@ -2660,7 +2653,7 @@ mrvl_rx_pkt_burst(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
                if (unlikely(num <= q->priv->bpool_min_size ||
                             (!rx_done && num < q->priv->bpool_init_size))) {
-                       mrvl_fill_bpool(q, MRVL_BURST_SIZE);
+                       mrvl_fill_bpool(q, q->priv->fill_bpool_buffs);
                } else if (unlikely(num > q->priv->bpool_max_size)) {
                        int i;
                        int pkt_to_remove = num - q->priv->bpool_init_size;