net/mlx5: fix packet length assert in MPRQ
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.c
index 84aa069..e9ae2f7 100644 (file)
@@ -894,6 +894,35 @@ flow_rxq_flags_clear(struct rte_eth_dev *dev)
        }
 }
 
+/**
+ * Set the Rx queue dynamic metadata (mask and offset) for a flow
+ *
+ * @param[in] dev
+ *   Pointer to the Ethernet device structure.
+ */
+void
+mlx5_flow_rxq_dynf_metadata_set(struct rte_eth_dev *dev)
+{
+       struct mlx5_priv *priv = dev->data->dev_private;
+       struct mlx5_rxq_data *data;
+       unsigned int i;
+
+       for (i = 0; i != priv->rxqs_n; ++i) {
+               if (!(*priv->rxqs)[i])
+                       continue;
+               data = (*priv->rxqs)[i];
+               if (!rte_flow_dynf_metadata_avail()) {
+                       data->dynf_meta = 0;
+                       data->flow_meta_mask = 0;
+                       data->flow_meta_offset = -1;
+               } else {
+                       data->dynf_meta = 1;
+                       data->flow_meta_mask = rte_flow_dynf_metadata_mask;
+                       data->flow_meta_offset = rte_flow_dynf_metadata_offs;
+               }
+       }
+}
+
 /*
  * return a pointer to the desired action in the list of actions.
  *
@@ -4495,9 +4524,12 @@ mlx5_flow_create(struct rte_eth_dev *dev,
         * are not affected.
         */
        if (unlikely(!dev->data->dev_started)) {
-               rte_errno = ENODEV;
                DRV_LOG(DEBUG, "port %u is not started when "
                        "inserting a flow", dev->data->port_id);
+               rte_flow_error_set(error, ENODEV,
+                                  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+                                  NULL,
+                                  "port not started");
                return NULL;
        }
        return (void *)(uintptr_t)flow_list_create(dev, &priv->flows,
@@ -4658,6 +4690,7 @@ void
 mlx5_flow_stop_default(struct rte_eth_dev *dev)
 {
        flow_mreg_del_default_copy_action(dev);
+       flow_rxq_flags_clear(dev);
 }
 
 /**