#include <rte_errno.h>
#include <rte_spinlock.h>
#include <rte_string_fns.h>
-#include <rte_compat.h>
#include "rte_ether.h"
#include "rte_ethdev.h"
#include "rte_ethdev_driver.h"
#include "ethdev_profile.h"
+static int ethdev_logtype;
+
+#define ethdev_log(level, fmt, ...) \
+ rte_log(RTE_LOG_ ## level, ethdev_logtype, fmt "\n", ## __VA_ARGS__)
+
static const char *MZ_RTE_ETH_DEV_DATA = "rte_eth_dev_data";
struct rte_eth_dev rte_eth_devices[RTE_MAX_ETHPORTS];
-static struct rte_eth_dev_data *rte_eth_dev_data;
static uint8_t eth_dev_last_created_port;
/* spinlock for eth device callbacks */
/* spinlock for add/remove tx callbacks */
static rte_spinlock_t rte_eth_tx_cb_lock = RTE_SPINLOCK_INITIALIZER;
+/* spinlock for shared data allocation */
+static rte_spinlock_t rte_eth_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
+
/* store statistics names and its offset in stats structure */
struct rte_eth_xstats_name_off {
char name[RTE_ETH_XSTATS_NAME_SIZE];
unsigned offset;
};
+/* Shared memory between primary and secondary processes. */
+static struct {
+ uint64_t next_owner_id;
+ rte_spinlock_t ownership_lock;
+ struct rte_eth_dev_data data[RTE_MAX_ETHPORTS];
+} *rte_eth_dev_shared_data;
+
static const struct rte_eth_xstats_name_off rte_stats_strings[] = {
{"rx_good_packets", offsetof(struct rte_eth_stats, ipackets)},
{"tx_good_packets", offsetof(struct rte_eth_stats, opackets)},
}
static void
-rte_eth_dev_data_alloc(void)
+rte_eth_dev_shared_data_prepare(void)
{
const unsigned flags = 0;
const struct rte_memzone *mz;
- if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
- mz = rte_memzone_reserve(MZ_RTE_ETH_DEV_DATA,
- RTE_MAX_ETHPORTS * sizeof(*rte_eth_dev_data),
- rte_socket_id(), flags);
- } else
- mz = rte_memzone_lookup(MZ_RTE_ETH_DEV_DATA);
- if (mz == NULL)
- rte_panic("Cannot allocate memzone for ethernet port data\n");
+ rte_spinlock_lock(&rte_eth_shared_data_lock);
+
+ if (rte_eth_dev_shared_data == NULL) {
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ /* Allocate port data and ownership shared memory. */
+ mz = rte_memzone_reserve(MZ_RTE_ETH_DEV_DATA,
+ sizeof(*rte_eth_dev_shared_data),
+ rte_socket_id(), flags);
+ } else
+ mz = rte_memzone_lookup(MZ_RTE_ETH_DEV_DATA);
+ if (mz == NULL)
+ rte_panic("Cannot allocate ethdev shared data\n");
+
+ rte_eth_dev_shared_data = mz->addr;
+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+ rte_eth_dev_shared_data->next_owner_id =
+ RTE_ETH_DEV_NO_OWNER + 1;
+ rte_spinlock_init(&rte_eth_dev_shared_data->ownership_lock);
+ memset(rte_eth_dev_shared_data->data, 0,
+ sizeof(rte_eth_dev_shared_data->data));
+ }
+ }
- rte_eth_dev_data = mz->addr;
- if (rte_eal_process_type() == RTE_PROC_PRIMARY)
- memset(rte_eth_dev_data, 0,
- RTE_MAX_ETHPORTS * sizeof(*rte_eth_dev_data));
+ rte_spinlock_unlock(&rte_eth_shared_data_lock);
}
struct rte_eth_dev *
unsigned i;
for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
- if (rte_eth_devices[i].state == RTE_ETH_DEV_UNUSED)
+ /* Using shared name field to find a free port. */
+ if (rte_eth_dev_shared_data->data[i].name[0] == '\0') {
+ RTE_ASSERT(rte_eth_devices[i].state ==
+ RTE_ETH_DEV_UNUSED);
return i;
+ }
}
return RTE_MAX_ETHPORTS;
}
{
struct rte_eth_dev *eth_dev = &rte_eth_devices[port_id];
- eth_dev->data = &rte_eth_dev_data[port_id];
+ eth_dev->data = &rte_eth_dev_shared_data->data[port_id];
eth_dev->state = RTE_ETH_DEV_ATTACHED;
eth_dev_last_created_port = port_id;
rte_eth_dev_allocate(const char *name)
{
uint16_t port_id;
- struct rte_eth_dev *eth_dev;
+ struct rte_eth_dev *eth_dev = NULL;
+
+ rte_eth_dev_shared_data_prepare();
+
+ /* Synchronize port creation between primary and secondary threads. */
+ rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
port_id = rte_eth_dev_find_free_port();
if (port_id == RTE_MAX_ETHPORTS) {
- RTE_PMD_DEBUG_TRACE("Reached maximum number of Ethernet ports\n");
- return NULL;
+ ethdev_log(ERR, "Reached maximum number of Ethernet ports");
+ goto unlock;
}
- if (rte_eth_dev_data == NULL)
- rte_eth_dev_data_alloc();
-
if (rte_eth_dev_allocated(name) != NULL) {
- RTE_PMD_DEBUG_TRACE("Ethernet Device with name %s already allocated!\n",
- name);
- return NULL;
+ ethdev_log(ERR,
+ "Ethernet Device with name %s already allocated!",
+ name);
+ goto unlock;
}
- memset(&rte_eth_dev_data[port_id], 0, sizeof(struct rte_eth_dev_data));
eth_dev = eth_dev_get(port_id);
snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
eth_dev->data->port_id = port_id;
eth_dev->data->mtu = ETHER_MTU;
- _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_NEW, NULL);
+unlock:
+ rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
+
+ if (eth_dev != NULL)
+ _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_NEW, NULL);
return eth_dev;
}
rte_eth_dev_attach_secondary(const char *name)
{
uint16_t i;
- struct rte_eth_dev *eth_dev;
+ struct rte_eth_dev *eth_dev = NULL;
- if (rte_eth_dev_data == NULL)
- rte_eth_dev_data_alloc();
+ rte_eth_dev_shared_data_prepare();
+
+ /* Synchronize port attachment to primary port creation and release. */
+ rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
- if (strcmp(rte_eth_dev_data[i].name, name) == 0)
+ if (strcmp(rte_eth_dev_shared_data->data[i].name, name) == 0)
break;
}
if (i == RTE_MAX_ETHPORTS) {
RTE_PMD_DEBUG_TRACE(
"device %s is not driven by the primary process\n",
name);
- return NULL;
+ } else {
+ eth_dev = eth_dev_get(i);
+ RTE_ASSERT(eth_dev->data->port_id == i);
}
- eth_dev = eth_dev_get(i);
- RTE_ASSERT(eth_dev->data->port_id == i);
-
+ rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
return eth_dev;
}
if (eth_dev == NULL)
return -EINVAL;
+ rte_eth_dev_shared_data_prepare();
+
+ rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
+
eth_dev->state = RTE_ETH_DEV_UNUSED;
+ memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data));
+
+ rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
+
_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_DESTROY, NULL);
return 0;
return 1;
}
+static int
+rte_eth_is_valid_owner_id(uint64_t owner_id)
+{
+ if (owner_id == RTE_ETH_DEV_NO_OWNER ||
+ rte_eth_dev_shared_data->next_owner_id <= owner_id) {
+ RTE_PMD_DEBUG_TRACE("Invalid owner_id=%016lX.\n", owner_id);
+ return 0;
+ }
+ return 1;
+}
+
+uint64_t __rte_experimental
+rte_eth_find_next_owned_by(uint16_t port_id, const uint64_t owner_id)
+{
+ while (port_id < RTE_MAX_ETHPORTS &&
+ ((rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED &&
+ rte_eth_devices[port_id].state != RTE_ETH_DEV_REMOVED) ||
+ rte_eth_devices[port_id].data->owner.id != owner_id))
+ port_id++;
+
+ if (port_id >= RTE_MAX_ETHPORTS)
+ return RTE_MAX_ETHPORTS;
+
+ return port_id;
+}
+
+int __rte_experimental
+rte_eth_dev_owner_new(uint64_t *owner_id)
+{
+ rte_eth_dev_shared_data_prepare();
+
+ rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
+
+ *owner_id = rte_eth_dev_shared_data->next_owner_id++;
+
+ rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
+ return 0;
+}
+
+static int
+_rte_eth_dev_owner_set(const uint16_t port_id, const uint64_t old_owner_id,
+ const struct rte_eth_dev_owner *new_owner)
+{
+ struct rte_eth_dev_owner *port_owner;
+ int sret;
+
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+
+ if (!rte_eth_is_valid_owner_id(new_owner->id) &&
+ !rte_eth_is_valid_owner_id(old_owner_id))
+ return -EINVAL;
+
+ port_owner = &rte_eth_devices[port_id].data->owner;
+ if (port_owner->id != old_owner_id) {
+ RTE_PMD_DEBUG_TRACE("Cannot set owner to port %d already owned"
+ " by %s_%016lX.\n", port_id,
+ port_owner->name, port_owner->id);
+ return -EPERM;
+ }
+
+ sret = snprintf(port_owner->name, RTE_ETH_MAX_OWNER_NAME_LEN, "%s",
+ new_owner->name);
+ if (sret < 0 || sret >= RTE_ETH_MAX_OWNER_NAME_LEN)
+ RTE_PMD_DEBUG_TRACE("Port %d owner name was truncated.\n",
+ port_id);
+
+ port_owner->id = new_owner->id;
+
+ RTE_PMD_DEBUG_TRACE("Port %d owner is %s_%016lX.\n", port_id,
+ new_owner->name, new_owner->id);
+
+ return 0;
+}
+
+int __rte_experimental
+rte_eth_dev_owner_set(const uint16_t port_id,
+ const struct rte_eth_dev_owner *owner)
+{
+ int ret;
+
+ rte_eth_dev_shared_data_prepare();
+
+ rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
+
+ ret = _rte_eth_dev_owner_set(port_id, RTE_ETH_DEV_NO_OWNER, owner);
+
+ rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
+ return ret;
+}
+
+int __rte_experimental
+rte_eth_dev_owner_unset(const uint16_t port_id, const uint64_t owner_id)
+{
+ const struct rte_eth_dev_owner new_owner = (struct rte_eth_dev_owner)
+ {.id = RTE_ETH_DEV_NO_OWNER, .name = ""};
+ int ret;
+
+ rte_eth_dev_shared_data_prepare();
+
+ rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
+
+ ret = _rte_eth_dev_owner_set(port_id, owner_id, &new_owner);
+
+ rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
+ return ret;
+}
+
+void __rte_experimental
+rte_eth_dev_owner_delete(const uint64_t owner_id)
+{
+ uint16_t port_id;
+
+ rte_eth_dev_shared_data_prepare();
+
+ rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
+
+ if (rte_eth_is_valid_owner_id(owner_id)) {
+ RTE_ETH_FOREACH_DEV_OWNED_BY(port_id, owner_id)
+ memset(&rte_eth_devices[port_id].data->owner, 0,
+ sizeof(struct rte_eth_dev_owner));
+ RTE_PMD_DEBUG_TRACE("All port owners owned by %016X identifier"
+ " have removed.\n", owner_id);
+ }
+
+ rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
+}
+
+int __rte_experimental
+rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner)
+{
+ int ret = 0;
+
+ rte_eth_dev_shared_data_prepare();
+
+ rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock);
+
+ if (!rte_eth_dev_is_valid_port(port_id)) {
+ RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id);
+ ret = -ENODEV;
+ } else {
+ rte_memcpy(owner, &rte_eth_devices[port_id].data->owner,
+ sizeof(*owner));
+ }
+
+ rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
+ return ret;
+}
+
int
rte_eth_dev_socket_id(uint16_t port_id)
{
}
void *
-rte_eth_dev_get_sec_ctx(uint8_t port_id)
+rte_eth_dev_get_sec_ctx(uint16_t port_id)
{
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, NULL);
return rte_eth_devices[port_id].security_ctx;
/* shouldn't check 'rte_eth_devices[i].data',
* because it might be overwritten by VDEV PMD */
- tmp = rte_eth_dev_data[port_id].name;
+ tmp = rte_eth_dev_shared_data->data[port_id].name;
strcpy(name, tmp);
return 0;
}
int
rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
{
- int i;
+ uint32_t pid;
if (name == NULL) {
RTE_PMD_DEBUG_TRACE("Null pointer is specified\n");
return -EINVAL;
}
- RTE_ETH_FOREACH_DEV(i) {
- if (!strncmp(name,
- rte_eth_dev_data[i].name, strlen(name))) {
-
- *port_id = i;
-
+ for (pid = 0; pid < RTE_MAX_ETHPORTS; pid++) {
+ if (rte_eth_devices[pid].state != RTE_ETH_DEV_UNUSED &&
+ !strcmp(name, rte_eth_dev_shared_data->data[pid].name)) {
+ *port_id = pid;
return 0;
}
}
+
return -ENODEV;
}
/* no point looking at the port count if no port exists */
if (!rte_eth_dev_count()) {
- RTE_LOG(ERR, EAL, "No port found for device (%s)\n", name);
+ ethdev_log(ERR, "No port found for device (%s)", name);
ret = -1;
goto err;
}
dev_flags = rte_eth_devices[port_id].data->dev_flags;
if (dev_flags & RTE_ETH_DEV_BONDED_SLAVE) {
- RTE_LOG(ERR, EAL, "Port %" PRIu16 " is bonded, cannot detach\n",
- port_id);
+ ethdev_log(ERR,
+ "Port %" PRIu16 " is bonded, cannot detach", port_id);
ret = -ENOTSUP;
goto err;
}
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
dev = &rte_eth_devices[port_id];
+ if (!dev->data->dev_started) {
+ RTE_PMD_DEBUG_TRACE(
+ "port %d must be started before start any queue\n", port_id);
+ return -EINVAL;
+ }
+
if (rx_queue_id >= dev->data->nb_rx_queues) {
RTE_PMD_DEBUG_TRACE("Invalid RX queue_id=%d\n", rx_queue_id);
return -EINVAL;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
dev = &rte_eth_devices[port_id];
+ if (!dev->data->dev_started) {
+ RTE_PMD_DEBUG_TRACE(
+ "port %d must be started before start any queue\n", port_id);
+ return -EINVAL;
+ }
+
if (tx_queue_id >= dev->data->nb_tx_queues) {
RTE_PMD_DEBUG_TRACE("Invalid TX queue_id=%d\n", tx_queue_id);
return -EINVAL;
rxmode->security = 0;
}
-const char *
+const char * __rte_experimental
rte_eth_dev_rx_offload_name(uint64_t offload)
{
const char *name = "UNKNOWN";
return name;
}
-const char *
+const char * __rte_experimental
rte_eth_dev_tx_offload_name(uint64_t offload)
{
const char *name = "UNKNOWN";
return eth_err(port_id, ret);
}
-int
+int __rte_experimental
rte_eth_dev_is_removed(uint16_t port_id)
{
struct rte_eth_dev *dev;
return dev->data->all_multicast;
}
-static inline int
-rte_eth_dev_atomic_read_link_status(struct rte_eth_dev *dev,
- struct rte_eth_link *link)
-{
- struct rte_eth_link *dst = link;
- struct rte_eth_link *src = &(dev->data->dev_link);
-
- if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
- *(uint64_t *)src) == 0)
- return -1;
-
- return 0;
-}
-
void
rte_eth_link_get(uint16_t port_id, struct rte_eth_link *eth_link)
{
RTE_ETH_VALID_PORTID_OR_RET(port_id);
dev = &rte_eth_devices[port_id];
- if (dev->data->dev_conf.intr_conf.lsc != 0)
- rte_eth_dev_atomic_read_link_status(dev, eth_link);
+ if (dev->data->dev_conf.intr_conf.lsc &&
+ dev->data->dev_started)
+ rte_eth_linkstatus_get(dev, eth_link);
else {
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
(*dev->dev_ops->link_update)(dev, 1);
RTE_ETH_VALID_PORTID_OR_RET(port_id);
dev = &rte_eth_devices[port_id];
- if (dev->data->dev_conf.intr_conf.lsc != 0)
- rte_eth_dev_atomic_read_link_status(dev, eth_link);
+ if (dev->data->dev_conf.intr_conf.lsc &&
+ dev->data->dev_started)
+ rte_eth_linkstatus_get(dev, eth_link);
else {
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->link_update);
(*dev->dev_ops->link_update)(dev, 0);
if (ids) {
for (i = 0; i < size; i++) {
- if (ids[i] > basic_count) {
+ if (ids[i] >= basic_count) {
no_ext_stat_requested = 0;
break;
}
if (ids) {
for (i = 0; i < size; i++) {
- if (ids[i] > basic_count) {
+ if (ids[i] >= basic_count) {
no_ext_stat_requested = 0;
break;
}
memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
dev_info->rx_desc_lim = lim;
dev_info->tx_desc_lim = lim;
+ dev_info->device = dev->device;
RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_infos_get);
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
return -EINVAL;
if (!rte_eth_dev_is_valid_port(port_id) && port_id != RTE_ETH_ALL) {
- RTE_LOG(ERR, EAL, "Invalid port_id=%d\n", port_id);
+ ethdev_log(ERR, "Invalid port_id=%d", port_id);
return -EINVAL;
}
return -EINVAL;
if (!rte_eth_dev_is_valid_port(port_id) && port_id != RTE_ETH_ALL) {
- RTE_LOG(ERR, EAL, "Invalid port_id=%d\n", port_id);
+ ethdev_log(ERR, "Invalid port_id=%d", port_id);
return -EINVAL;
}
if (mz)
return mz;
- return rte_memzone_reserve_aligned(z_name, size, socket_id, 0, align);
+ return rte_memzone_reserve_aligned(z_name, size, socket_id,
+ RTE_MEMZONE_IOVA_CONTIG, align);
}
int
}
int
-rte_eth_dev_filter_ctrl_v22(uint16_t port_id,
- enum rte_filter_type filter_type,
- enum rte_filter_op filter_op, void *arg);
-
-int
-rte_eth_dev_filter_ctrl_v22(uint16_t port_id,
- enum rte_filter_type filter_type,
- enum rte_filter_op filter_op, void *arg)
-{
- struct rte_eth_fdir_info_v22 {
- enum rte_fdir_mode mode;
- struct rte_eth_fdir_masks mask;
- struct rte_eth_fdir_flex_conf flex_conf;
- uint32_t guarant_spc;
- uint32_t best_spc;
- uint32_t flow_types_mask[1];
- uint32_t max_flexpayload;
- uint32_t flex_payload_unit;
- uint32_t max_flex_payload_segment_num;
- uint16_t flex_payload_limit;
- uint32_t flex_bitmask_unit;
- uint32_t max_flex_bitmask_num;
- };
-
- struct rte_eth_hash_global_conf_v22 {
- enum rte_eth_hash_function hash_func;
- uint32_t sym_hash_enable_mask[1];
- uint32_t valid_bit_mask[1];
- };
-
- struct rte_eth_hash_filter_info_v22 {
- enum rte_eth_hash_filter_info_type info_type;
- union {
- uint8_t enable;
- struct rte_eth_hash_global_conf_v22 global_conf;
- struct rte_eth_input_set_conf input_set_conf;
- } info;
- };
-
- struct rte_eth_dev *dev;
-
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
- dev = &rte_eth_devices[port_id];
- RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->filter_ctrl, -ENOTSUP);
- if (filter_op == RTE_ETH_FILTER_INFO) {
- int retval;
- struct rte_eth_fdir_info_v22 *fdir_info_v22;
- struct rte_eth_fdir_info fdir_info;
-
- fdir_info_v22 = (struct rte_eth_fdir_info_v22 *)arg;
-
- retval = (*dev->dev_ops->filter_ctrl)(dev, filter_type,
- filter_op, (void *)&fdir_info);
- fdir_info_v22->mode = fdir_info.mode;
- fdir_info_v22->mask = fdir_info.mask;
- fdir_info_v22->flex_conf = fdir_info.flex_conf;
- fdir_info_v22->guarant_spc = fdir_info.guarant_spc;
- fdir_info_v22->best_spc = fdir_info.best_spc;
- fdir_info_v22->flow_types_mask[0] =
- (uint32_t)fdir_info.flow_types_mask[0];
- fdir_info_v22->max_flexpayload = fdir_info.max_flexpayload;
- fdir_info_v22->flex_payload_unit = fdir_info.flex_payload_unit;
- fdir_info_v22->max_flex_payload_segment_num =
- fdir_info.max_flex_payload_segment_num;
- fdir_info_v22->flex_payload_limit =
- fdir_info.flex_payload_limit;
- fdir_info_v22->flex_bitmask_unit = fdir_info.flex_bitmask_unit;
- fdir_info_v22->max_flex_bitmask_num =
- fdir_info.max_flex_bitmask_num;
- return retval;
- } else if (filter_op == RTE_ETH_FILTER_GET) {
- int retval;
- struct rte_eth_hash_filter_info f_info;
- struct rte_eth_hash_filter_info_v22 *f_info_v22 =
- (struct rte_eth_hash_filter_info_v22 *)arg;
-
- f_info.info_type = f_info_v22->info_type;
- retval = (*dev->dev_ops->filter_ctrl)(dev, filter_type,
- filter_op, (void *)&f_info);
-
- switch (f_info_v22->info_type) {
- case RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT:
- f_info_v22->info.enable = f_info.info.enable;
- break;
- case RTE_ETH_HASH_FILTER_GLOBAL_CONFIG:
- f_info_v22->info.global_conf.hash_func =
- f_info.info.global_conf.hash_func;
- f_info_v22->info.global_conf.sym_hash_enable_mask[0] =
- (uint32_t)
- f_info.info.global_conf.sym_hash_enable_mask[0];
- f_info_v22->info.global_conf.valid_bit_mask[0] =
- (uint32_t)
- f_info.info.global_conf.valid_bit_mask[0];
- break;
- case RTE_ETH_HASH_FILTER_INPUT_SET_SELECT:
- f_info_v22->info.input_set_conf =
- f_info.info.input_set_conf;
- break;
- default:
- break;
- }
- return retval;
- } else if (filter_op == RTE_ETH_FILTER_SET) {
- struct rte_eth_hash_filter_info f_info;
- struct rte_eth_hash_filter_info_v22 *f_v22 =
- (struct rte_eth_hash_filter_info_v22 *)arg;
-
- f_info.info_type = f_v22->info_type;
- switch (f_v22->info_type) {
- case RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT:
- f_info.info.enable = f_v22->info.enable;
- break;
- case RTE_ETH_HASH_FILTER_GLOBAL_CONFIG:
- f_info.info.global_conf.hash_func =
- f_v22->info.global_conf.hash_func;
- f_info.info.global_conf.sym_hash_enable_mask[0] =
- (uint32_t)
- f_v22->info.global_conf.sym_hash_enable_mask[0];
- f_info.info.global_conf.valid_bit_mask[0] =
- (uint32_t)
- f_v22->info.global_conf.valid_bit_mask[0];
- break;
- case RTE_ETH_HASH_FILTER_INPUT_SET_SELECT:
- f_info.info.input_set_conf =
- f_v22->info.input_set_conf;
- break;
- default:
- break;
- }
- return (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op,
- (void *)&f_info);
- } else
- return (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op,
- arg);
-}
-VERSION_SYMBOL(rte_eth_dev_filter_ctrl, _v22, 2.2);
-
-int
-rte_eth_dev_filter_ctrl_v1802(uint16_t port_id,
- enum rte_filter_type filter_type,
- enum rte_filter_op filter_op, void *arg);
-
-int
-rte_eth_dev_filter_ctrl_v1802(uint16_t port_id,
- enum rte_filter_type filter_type,
- enum rte_filter_op filter_op, void *arg)
+rte_eth_dev_filter_ctrl(uint16_t port_id, enum rte_filter_type filter_type,
+ enum rte_filter_op filter_op, void *arg)
{
struct rte_eth_dev *dev;
return eth_err(port_id, (*dev->dev_ops->filter_ctrl)(dev, filter_type,
filter_op, arg));
}
-BIND_DEFAULT_SYMBOL(rte_eth_dev_filter_ctrl, _v1802, 18.02);
-MAP_STATIC_SYMBOL(int rte_eth_dev_filter_ctrl(uint16_t port_id,
- enum rte_filter_type filter_type,
- enum rte_filter_op filter_op, void *arg),
- rte_eth_dev_filter_ctrl_v1802);
-void *
+const struct rte_eth_rxtx_callback *
rte_eth_add_rx_callback(uint16_t port_id, uint16_t queue_id,
rte_rx_callback_fn fn, void *user_param)
{
return cb;
}
-void *
+const struct rte_eth_rxtx_callback *
rte_eth_add_first_rx_callback(uint16_t port_id, uint16_t queue_id,
rte_rx_callback_fn fn, void *user_param)
{
return cb;
}
-void *
+const struct rte_eth_rxtx_callback *
rte_eth_add_tx_callback(uint16_t port_id, uint16_t queue_id,
rte_tx_callback_fn fn, void *user_param)
{
int
rte_eth_remove_rx_callback(uint16_t port_id, uint16_t queue_id,
- struct rte_eth_rxtx_callback *user_cb)
+ const struct rte_eth_rxtx_callback *user_cb)
{
#ifndef RTE_ETHDEV_RXTX_CALLBACKS
return -ENOTSUP;
int
rte_eth_remove_tx_callback(uint16_t port_id, uint16_t queue_id,
- struct rte_eth_rxtx_callback *user_cb)
+ const struct rte_eth_rxtx_callback *user_cb)
{
#ifndef RTE_ETHDEV_RXTX_CALLBACKS
return -ENOTSUP;
return (*dev->dev_ops->pool_ops_supported)(dev, pool);
}
+
+RTE_INIT(ethdev_init_log);
+static void
+ethdev_init_log(void)
+{
+ ethdev_logtype = rte_log_register("lib.ethdev");
+ if (ethdev_logtype >= 0)
+ rte_log_set_level(ethdev_logtype, RTE_LOG_INFO);
+}