27 #include <rte_ethdev.h>
41 #define SLEEP_IN_NANOS (10 * 1000)
46 uint16_t proxy_port_id;
49 ret = rte_flow_pick_transfer_proxy(port_id, &proxy_port_id,
NULL);
51 DOCA_LOG_ERR(
"Failed getting proxy port: %s", strerror(-ret));
55 if (proxy_port_id == port_id)
79 memcpy(val_copy, iface_name, strlen(iface_name));
102 uint8_t is_addr_equal = 0;
119 struct doca_dev **connected_dev,
124 static bool is_secured_set, is_unsecured_set;
128 DOCA_LOG_ERR(
"Failed to find DOCA device associated with port ID %d: %s",
136 DOCA_LOG_ERR(
"Failed to find DOCA device associated with port ID %d", port_id);
140 if (!is_secured_set &&
app_cfg->objects.secured_dev.open_by_pci) {
143 is_secured_set =
true;
146 }
else if (!is_secured_set &&
app_cfg->objects.secured_dev.open_by_name) {
149 is_secured_set =
true;
153 if (!is_unsecured_set &&
app_cfg->objects.unsecured_dev.open_by_pci) {
156 is_unsecured_set =
true;
159 }
else if (!is_unsecured_set &&
app_cfg->objects.unsecured_dev.open_by_name) {
162 is_unsecured_set =
true;
233 DOCA_LOG_ERR(
"Failed to open DOCA device for the unsecured port: %s",
241 goto close_unsecured;
247 goto close_unsecured;
251 app_cfg->objects.secured_dev.doca_dev,
252 "dv_flow_en=2,dv_xmeta_en=4,fdb_def_rule_en=0,vport_match=1,repr_matching_en=0,representor=pf[0-1]");
doca_error_t open_doca_device_with_iface_name(const uint8_t *value, size_t val_size, tasks_check func, struct doca_dev **retval)
static doca_error_t open_doca_device_with_pci(const char *pcie_value, struct doca_dev **retval)
struct rte_eth_dev_info dev_info
static struct app_gpu_cfg app_cfg
DOCA_STABLE doca_error_t doca_devinfo_is_equal_pci_addr(const struct doca_devinfo *devinfo, const char *pci_addr_str, uint8_t *is_equal)
Check if a PCI address belongs to a DOCA devinfo.
#define DOCA_DEVINFO_IFACE_NAME_SIZE
Buffer size to hold network interface name. Including a null terminator.
DOCA_STABLE struct doca_devinfo * doca_dev_as_devinfo(const struct doca_dev *dev)
Get local device info from device. This should be useful when wanting to query information about devi...
DOCA_STABLE doca_error_t doca_devinfo_get_iface_name(const struct doca_devinfo *devinfo, char *iface_name, uint32_t size)
Get the name of the ethernet interface of a DOCA devinfo.
DOCA_STABLE doca_error_t doca_dev_close(struct doca_dev *dev)
Destroy allocated local device instance.
DOCA_EXPERIMENTAL doca_error_t doca_dpdk_port_probe(struct doca_dev *dev, const char *devargs)
Attach a DPDK port specified by DOCA device.
DOCA_EXPERIMENTAL doca_error_t doca_dpdk_port_as_dev(uint16_t port_id, struct doca_dev **dev)
Return the DOCA device associated with a DPDK port.
#define DOCA_ERROR_PROPAGATE(r, t)
Save the first encountered doca_error_t.
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
@ DOCA_ERROR_INVALID_VALUE
@ DOCA_ERROR_INITIALIZATION
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
static doca_error_t compare_device_name(struct doca_devinfo *dev_info, const char *iface_name)
doca_error_t ipsec_security_gw_init_devices(struct ipsec_security_gw_config *app_cfg)
DOCA_LOG_REGISTER(IPSEC_SECURITY_GW::ipsec_ctx)
static doca_error_t compare_device_pci_addr(struct doca_devinfo *dev_info, const char *pci_addr)
doca_error_t find_port_action_type_vnf(const struct ipsec_security_gw_config *app_cfg, int port_id, struct doca_dev **connected_dev, int *idx)
doca_error_t find_port_action_type_switch(int port_id, int *idx)
static doca_error_t open_doca_device(struct ipsec_security_gw_dev_info *info, tasks_check func)
doca_error_t ipsec_security_gw_close_devices(const struct ipsec_security_gw_config *app_cfg)
doca_error_t(* tasks_check)(struct doca_devinfo *)
struct doca_dev * doca_dev
char pci_addr[DOCA_DEVINFO_PCI_ADDR_SIZE]
char iface_name[DOCA_DEVINFO_IFACE_NAME_SIZE]