Enable flow ops getter.
Signed-off-by: Serhii Iliushyk <sil-plv@napatech.com>
---
v2
* Change cast to void with __rte_unused
---
drivers/net/ntnic/include/create_elements.h | 13 +++++++
.../ntnic/include/stream_binary_flow_api.h | 2 +
drivers/net/ntnic/meson.build | 1 +
drivers/net/ntnic/ntnic_ethdev.c | 7 ++++
drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 37 +++++++++++++++++++
drivers/net/ntnic/ntnic_mod_reg.c | 15 ++++++++
drivers/net/ntnic/ntnic_mod_reg.h | 5 +++
7 files changed, 80 insertions(+)
create mode 100644 drivers/net/ntnic/include/create_elements.h
create mode 100644 drivers/net/ntnic/ntnic_filter/ntnic_filter.c
new file mode 100644
@@ -0,0 +1,13 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __CREATE_ELEMENTS_H__
+#define __CREATE_ELEMENTS_H__
+
+
+#include "stream_binary_flow_api.h"
+#include <rte_flow.h>
+
+#endif /* __CREATE_ELEMENTS_H__ */
@@ -6,6 +6,8 @@
#ifndef _STREAM_BINARY_FLOW_API_H_
#define _STREAM_BINARY_FLOW_API_H_
+#include "rte_flow.h"
+#include "rte_flow_driver.h"
/*
* Flow frontend for binary programming interface
*/
@@ -79,6 +79,7 @@ sources = files(
'nthw/nthw_platform.c',
'nthw/nthw_rac.c',
'ntlog/ntlog.c',
+ 'ntnic_filter/ntnic_filter.c',
'ntutil/nt_util.c',
'ntnic_mod_reg.c',
'ntnic_vfio.c',
@@ -1321,6 +1321,12 @@ eth_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, size_t fw_size
}
}
+static int dev_flow_ops_get(struct rte_eth_dev *dev __rte_unused, const struct rte_flow_ops **ops)
+{
+ *ops = get_dev_flow_ops();
+ return 0;
+}
+
static int
promiscuous_enable(struct rte_eth_dev __rte_unused(*dev))
{
@@ -1349,6 +1355,7 @@ static const struct eth_dev_ops nthw_eth_dev_ops = {
.mac_addr_add = eth_mac_addr_add,
.mac_addr_set = eth_mac_addr_set,
.set_mc_addr_list = eth_set_mc_addr_list,
+ .flow_ops_get = dev_flow_ops_get,
.promiscuous_enable = promiscuous_enable,
};
new file mode 100644
@@ -0,0 +1,37 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <rte_flow_driver.h>
+#include "ntnic_mod_reg.h"
+
+static int
+eth_flow_destroy(struct rte_eth_dev *eth_dev __rte_unused, struct rte_flow *flow __rte_unused,
+ struct rte_flow_error *error __rte_unused)
+{
+ int res = 0;
+
+ return res;
+}
+
+static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev __rte_unused,
+ const struct rte_flow_attr *attr __rte_unused,
+ const struct rte_flow_item items[] __rte_unused,
+ const struct rte_flow_action actions[] __rte_unused,
+ struct rte_flow_error *error __rte_unused)
+{
+ struct rte_flow *flow = NULL;
+
+ return flow;
+}
+
+static const struct rte_flow_ops dev_flow_ops = {
+ .create = eth_flow_create,
+ .destroy = eth_flow_destroy,
+};
+
+void dev_flow_init(void)
+{
+ register_dev_flow_ops(&dev_flow_ops);
+}
@@ -137,3 +137,18 @@ const struct flow_filter_ops *get_flow_filter_ops(void)
return flow_filter_ops;
}
+
+static const struct rte_flow_ops *dev_flow_ops;
+
+void register_dev_flow_ops(const struct rte_flow_ops *ops)
+{
+ dev_flow_ops = ops;
+}
+
+const struct rte_flow_ops *get_dev_flow_ops(void)
+{
+ if (dev_flow_ops == NULL)
+ dev_flow_init();
+
+ return dev_flow_ops;
+}
@@ -15,6 +15,7 @@
#include "nt4ga_adapter.h"
#include "ntnic_nthw_fpga_rst_nt200a0x.h"
#include "ntnic_virt_queue.h"
+#include "create_elements.h"
/* sg ops section */
struct sg_ops_s {
@@ -243,6 +244,10 @@ struct flow_filter_ops {
uint32_t exception_path);
};
+void register_dev_flow_ops(const struct rte_flow_ops *ops);
+const struct rte_flow_ops *get_dev_flow_ops(void);
+void dev_flow_init(void);
+
void register_flow_filter_ops(const struct flow_filter_ops *ops);
const struct flow_filter_ops *get_flow_filter_ops(void);
void init_flow_filter(void);