drivers/net: remove unnecessary macro for unused variables
[dpdk.git] / drivers / net / i40e / i40e_flow.c
index fa76285..8d1fcde 100644 (file)
@@ -135,7 +135,7 @@ i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
                              struct rte_flow_error *error,
                              union i40e_filter_t *filter);
 static int
-i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
+i40e_flow_parse_qinq_pattern(struct rte_eth_dev *dev,
                              const struct rte_flow_item *pattern,
                              struct rte_flow_error *error,
                              struct i40e_tunnel_filter_conf *filter);
@@ -608,6 +608,7 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev,
 
                        if (filter->ether_type == ETHER_TYPE_IPv4 ||
                            filter->ether_type == ETHER_TYPE_IPv6 ||
+                           filter->ether_type == ETHER_TYPE_LLDP ||
                            filter->ether_type == outer_tpid) {
                                rte_flow_error_set(error, EINVAL,
                                                   RTE_FLOW_ERROR_TYPE_ITEM,
@@ -1234,13 +1235,19 @@ i40e_flow_parse_tunnel_action(struct rte_eth_dev *dev,
        if (act->type == RTE_FLOW_ACTION_TYPE_QUEUE) {
                act_q = (const struct rte_flow_action_queue *)act->conf;
                filter->queue_id = act_q->index;
-               if (!filter->is_to_vf)
-                       if (filter->queue_id >= pf->dev_data->nb_rx_queues) {
-                               rte_flow_error_set(error, EINVAL,
+               if ((!filter->is_to_vf) &&
+                   (filter->queue_id >= pf->dev_data->nb_rx_queues)) {
+                       rte_flow_error_set(error, EINVAL,
                                   RTE_FLOW_ERROR_TYPE_ACTION,
                                   act, "Invalid queue ID for tunnel filter");
-                               return -rte_errno;
-                       }
+                       return -rte_errno;
+               } else if (filter->is_to_vf &&
+                          (filter->queue_id >= pf->vf_nb_qps)) {
+                       rte_flow_error_set(error, EINVAL,
+                                  RTE_FLOW_ERROR_TYPE_ACTION,
+                                  act, "Invalid queue ID for tunnel filter");
+                       return -rte_errno;
+               }
        }
 
        /* Check if the next non-void item is END */
@@ -1740,6 +1747,13 @@ i40e_flow_parse_mpls_filter(struct rte_eth_dev *dev,
        return ret;
 }
 
+/* 1. Last in item should be NULL as range is not supported.
+ * 2. Supported filter types: QINQ.
+ * 3. Mask of fields which need to be matched should be
+ *    filled with 1.
+ * 4. Mask of fields which needn't to be matched should be
+ *    filled with 0.
+ */
 static int
 i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
                              const struct rte_flow_item *pattern,
@@ -1747,8 +1761,6 @@ i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
                              struct i40e_tunnel_filter_conf *filter)
 {
        const struct rte_flow_item *item = pattern;
-       const struct rte_flow_item_eth *eth_spec;
-       const struct rte_flow_item_eth *eth_mask;
        const struct rte_flow_item_vlan *vlan_spec = NULL;
        const struct rte_flow_item_vlan *vlan_mask = NULL;
        const struct rte_flow_item_vlan *i_vlan_spec = NULL;
@@ -1770,13 +1782,11 @@ i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
                item_type = item->type;
                switch (item_type) {
                case RTE_FLOW_ITEM_TYPE_ETH:
-                       eth_spec = (const struct rte_flow_item_eth *)item->spec;
-                       eth_mask = (const struct rte_flow_item_eth *)item->mask;
-                       if (eth_spec && eth_mask) {
+                       if (item->spec || item->mask) {
                                rte_flow_error_set(error, EINVAL,
                                                   RTE_FLOW_ERROR_TYPE_ITEM,
                                                   item,
-                                                  "Invalid ether spec/mask");
+                                                  "Invalid ETH item");
                                return -rte_errno;
                        }
                        break;