net/hinic: add flow validation operations

This patch is to validate the filter rules, which includes
ntuple filter, ethertype filter and fdir filter. The packets
type that supported are BGP,VRRP,LACP,ARP and ICMP.

Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
This commit is contained in:
Xiaoyun Wang 2019-10-10 22:51:52 +08:00 committed by Ferruh Yigit
parent a5d668e637
commit 73122b52e8
6 changed files with 1241 additions and 0 deletions

View File

@ -118,6 +118,7 @@ New Features
* Enabled SR-IOV - Partially supported at this point, VFIO only.
* Supported VLAN filter and VLAN offload.
* Supported Unicast MAC filter and Multicast MAC filter.
* Supported Flow director for LACP, VRRP, BGP and so on.
* **Added Marvell NITROX symmetric crypto PMD.**

View File

@ -60,6 +60,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_niccfg.c
SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_nicio.c
SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_wq.c
SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_mbox.c
SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_flow.c
SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_ethdev.c
SRCS-$(CONFIG_RTE_LIBRTE_HINIC_PMD) += hinic_pmd_rx.c

View File

@ -2285,6 +2285,46 @@ static int hinic_set_mc_addr_list(struct rte_eth_dev *dev,
return 0;
}
/**
* DPDK callback to manage filter operations
*
* @param dev
* Pointer to Ethernet device structure.
* @param filter_type
* Filter type.
* @param filter_op
* Operation to perform.
* @param arg
* Pointer to operation-specific structure.
*
* @return
* 0 on success, negative errno value on failure.
*/
static int hinic_dev_filter_ctrl(struct rte_eth_dev *dev,
enum rte_filter_type filter_type,
enum rte_filter_op filter_op,
void *arg)
{
struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
int func_id = hinic_global_func_id(nic_dev->hwdev);
switch (filter_type) {
case RTE_ETH_FILTER_GENERIC:
if (filter_op != RTE_ETH_FILTER_GET)
return -EINVAL;
*(const void **)arg = &hinic_flow_ops;
break;
default:
PMD_DRV_LOG(INFO, "Filter type (%d) not supported",
filter_type);
return -EINVAL;
}
PMD_DRV_LOG(INFO, "Set filter_ctrl succeed, func_id: 0x%x, filter_type: 0x%x,"
"filter_op: 0x%x.", func_id, filter_type, filter_op);
return 0;
}
static int hinic_set_default_pause_feature(struct hinic_nic_dev *nic_dev)
{
struct nic_pause_config pause_config = {0};
@ -2736,6 +2776,7 @@ static const struct eth_dev_ops hinic_pmd_ops = {
.mac_addr_remove = hinic_mac_addr_remove,
.mac_addr_add = hinic_mac_addr_add,
.set_mc_addr_list = hinic_set_mc_addr_list,
.filter_ctrl = hinic_dev_filter_ctrl,
};
static const struct eth_dev_ops hinic_pmd_vf_ops = {
@ -2767,6 +2808,7 @@ static const struct eth_dev_ops hinic_pmd_vf_ops = {
.mac_addr_remove = hinic_mac_addr_remove,
.mac_addr_add = hinic_mac_addr_add,
.set_mc_addr_list = hinic_set_mc_addr_list,
.filter_ctrl = hinic_dev_filter_ctrl,
};
static int hinic_func_init(struct rte_eth_dev *eth_dev)

View File

@ -38,6 +38,30 @@ enum hinic_dev_status {
HINIC_DEV_INTR_EN,
};
/* Information about the fdir mode. */
struct hinic_hw_fdir_mask {
uint32_t src_ipv4_mask;
uint32_t dst_ipv4_mask;
uint16_t src_port_mask;
uint16_t dst_port_mask;
};
/* Flow Director attribute */
struct hinic_atr_input {
u32 dst_ip;
u32 src_ip;
u16 src_port;
u16 dst_port;
};
struct hinic_fdir_rule {
struct hinic_hw_fdir_mask mask;
struct hinic_atr_input hinic_fdir; /* key of fdir filter */
uint8_t queue; /* queue assigned when matched */
};
extern const struct rte_flow_ops hinic_flow_ops;
/* hinic nic_device */
struct hinic_nic_dev {
/* hardware device */

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ sources = files(
'hinic_pmd_ethdev.c',
'hinic_pmd_rx.c',
'hinic_pmd_tx.c',
'hinic_pmd_flow.c',
)
includes += include_directories('base')