#include <unistd.h>
#include <stdarg.h>
#include <inttypes.h>
-#include <netinet/in.h>
#include <rte_byteorder.h>
#include <rte_common.h>
#include <rte_cycles.h>
#include <rte_eal.h>
#include <rte_alarm.h>
#include <rte_ether.h>
-#include <rte_ethdev_driver.h>
+#include <ethdev_driver.h>
#include <rte_malloc.h>
#include <rte_random.h>
#include <rte_dev.h>
#include "base/ixgbe_api.h"
#include "base/ixgbe_vf.h"
#include "base/ixgbe_common.h"
+#include "base/ixgbe_osdep.h"
#include "ixgbe_ethdev.h"
#include "ixgbe_bypass.h"
#include "ixgbe_rxtx.h"
/* l2_tunnel filter list structure */
struct ixgbe_eth_l2_tunnel_conf_ele {
TAILQ_ENTRY(ixgbe_eth_l2_tunnel_conf_ele) entries;
- struct rte_eth_l2_tunnel_conf filter_info;
+ struct ixgbe_l2_tunnel_conf filter_info;
};
/* rss filter list structure */
struct ixgbe_rss_conf_ele {
}
/**
- * Please aware there's an asumption for all the parsers.
+ * Please be aware there's an assumption for all the parsers.
* rte_flow_item is using big endian, rte_flow_attr and
* rte_flow_action are using CPU order.
* Because the pattern is used to describe the packets,
if (ret)
return ret;
- /* Ixgbe doesn't support MAC address. */
- if (filter->flags & RTE_ETHTYPE_FLAGS_MAC) {
- memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
- rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_ITEM,
- NULL, "Not supported by ethertype filter");
- return -rte_errno;
- }
-
if (filter->queue >= dev->data->nb_rx_queues) {
memset(filter, 0, sizeof(struct rte_eth_ethertype_filter));
rte_flow_error_set(error, EINVAL,
const struct rte_flow_attr *attr,
const struct rte_flow_item pattern[],
const struct rte_flow_action actions[],
- struct rte_eth_l2_tunnel_conf *filter,
+ struct ixgbe_l2_tunnel_conf *filter,
struct rte_flow_error *error)
{
const struct rte_flow_item *item;
/* The first not void item should be e-tag. */
item = next_no_void_pattern(pattern, NULL);
if (item->type != RTE_FLOW_ITEM_TYPE_E_TAG) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item, "Not supported by L2 tunnel filter");
}
if (!item->spec || !item->mask) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
item, "Not supported by L2 tunnel filter");
return -rte_errno;
e_tag_mask->in_ecid_e ||
e_tag_mask->ecid_e ||
e_tag_mask->rsvd_grp_ecid_b != rte_cpu_to_be_16(0x3FFF)) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item, "Not supported by L2 tunnel filter");
return -rte_errno;
}
- filter->l2_tunnel_type = RTE_L2_TUNNEL_TYPE_E_TAG;
+ filter->l2_tunnel_type = RTE_ETH_L2_TUNNEL_TYPE_E_TAG;
/**
* grp and e_cid_base are bit fields and only use 14 bits.
* e-tag id is taken as little endian by HW.
/* check if the next not void item is END */
item = next_no_void_pattern(pattern, item);
if (item->type != RTE_FLOW_ITEM_TYPE_END) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
item, "Not supported by L2 tunnel filter");
/* parse attr */
/* must be input direction */
if (!attr->ingress) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
attr, "Only support ingress.");
/* not supported */
if (attr->egress) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
attr, "Not support egress.");
/* not supported */
if (attr->transfer) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER,
attr, "No support for transfer.");
/* not supported */
if (attr->priority) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
attr, "Not support priority.");
act = next_no_void_action(actions, NULL);
if (act->type != RTE_FLOW_ACTION_TYPE_VF &&
act->type != RTE_FLOW_ACTION_TYPE_PF) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
act, "Not supported action.");
/* check if the next not void item is END */
act = next_no_void_action(actions, act);
if (act->type != RTE_FLOW_ACTION_TYPE_END) {
- memset(filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION,
act, "Not supported action.");
const struct rte_flow_attr *attr,
const struct rte_flow_item pattern[],
const struct rte_flow_action actions[],
- struct rte_eth_l2_tunnel_conf *l2_tn_filter,
+ struct ixgbe_l2_tunnel_conf *l2_tn_filter,
struct rte_flow_error *error)
{
int ret = 0;
if (hw->mac.type != ixgbe_mac_X550 &&
hw->mac.type != ixgbe_mac_X550EM_x &&
hw->mac.type != ixgbe_mac_X550EM_a) {
- memset(l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(l2_tn_filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM,
NULL, "Not supported by L2 tunnel filter");
struct rte_eth_ethertype_filter ethertype_filter;
struct rte_eth_syn_filter syn_filter;
struct ixgbe_fdir_rule fdir_rule;
- struct rte_eth_l2_tunnel_conf l2_tn_filter;
+ struct ixgbe_l2_tunnel_conf l2_tn_filter;
struct ixgbe_hw_fdir_info *fdir_info =
IXGBE_DEV_PRIVATE_TO_FDIR_INFO(dev->data->dev_private);
struct ixgbe_rte_flow_rss_conf rss_conf;
rte_memcpy(&fdir_info->mask,
&fdir_rule.mask,
sizeof(struct ixgbe_hw_fdir_mask));
- fdir_info->flex_bytes_offset =
- fdir_rule.flex_bytes_offset;
- if (fdir_rule.mask.flex_bytes_mask)
- ixgbe_fdir_set_flexbytes_offset(dev,
+ if (fdir_rule.mask.flex_bytes_mask) {
+ ret = ixgbe_fdir_set_flexbytes_offset(dev,
fdir_rule.flex_bytes_offset);
-
+ if (ret)
+ goto out;
+ }
ret = ixgbe_fdir_set_input_mask(dev);
if (ret)
goto out;
if (ret)
goto out;
- if (fdir_info->flex_bytes_offset !=
- fdir_rule.flex_bytes_offset)
+ if (fdir_rule.mask.flex_bytes_mask &&
+ fdir_info->flex_bytes_offset !=
+ fdir_rule.flex_bytes_offset)
goto out;
}
}
goto out;
}
- memset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(&l2_tn_filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
ret = ixgbe_parse_l2_tn_filter(dev, attr, pattern,
actions, &l2_tn_filter, error);
if (!ret) {
}
rte_memcpy(&l2_tn_filter_ptr->filter_info,
&l2_tn_filter,
- sizeof(struct rte_eth_l2_tunnel_conf));
+ sizeof(struct ixgbe_l2_tunnel_conf));
TAILQ_INSERT_TAIL(&filter_l2_tunnel_list,
l2_tn_filter_ptr, entries);
flow->rule = l2_tn_filter_ptr;
/**
* Check if the flow rule is supported by ixgbe.
- * It only checkes the format. Don't guarantee the rule can be programmed into
+ * It only checks the format. Don't guarantee the rule can be programmed into
* the HW. Because there can be no enough room for the rule.
*/
static int
struct rte_eth_ntuple_filter ntuple_filter;
struct rte_eth_ethertype_filter ethertype_filter;
struct rte_eth_syn_filter syn_filter;
- struct rte_eth_l2_tunnel_conf l2_tn_filter;
+ struct ixgbe_l2_tunnel_conf l2_tn_filter;
struct ixgbe_fdir_rule fdir_rule;
struct ixgbe_rte_flow_rss_conf rss_conf;
int ret;
if (!ret)
return 0;
- memset(&l2_tn_filter, 0, sizeof(struct rte_eth_l2_tunnel_conf));
+ memset(&l2_tn_filter, 0, sizeof(struct ixgbe_l2_tunnel_conf));
ret = ixgbe_parse_l2_tn_filter(dev, attr, pattern,
actions, &l2_tn_filter, error);
if (!ret)
struct rte_eth_ethertype_filter ethertype_filter;
struct rte_eth_syn_filter syn_filter;
struct ixgbe_fdir_rule fdir_rule;
- struct rte_eth_l2_tunnel_conf l2_tn_filter;
+ struct ixgbe_l2_tunnel_conf l2_tn_filter;
struct ixgbe_ntuple_filter_ele *ntuple_filter_ptr;
struct ixgbe_ethertype_filter_ele *ethertype_filter_ptr;
struct ixgbe_eth_syn_filter_ele *syn_filter_ptr;
l2_tn_filter_ptr = (struct ixgbe_eth_l2_tunnel_conf_ele *)
pmd_flow->rule;
rte_memcpy(&l2_tn_filter, &l2_tn_filter_ptr->filter_info,
- sizeof(struct rte_eth_l2_tunnel_conf));
+ sizeof(struct ixgbe_l2_tunnel_conf));
ret = ixgbe_dev_l2_tunnel_filter_del(dev, &l2_tn_filter);
if (!ret) {
TAILQ_REMOVE(&filter_l2_tunnel_list,
TAILQ_REMOVE(&ixgbe_flow_list,
ixgbe_flow_mem_ptr, entries);
rte_free(ixgbe_flow_mem_ptr);
+ break;
}
}
rte_free(flow);