char *cls_str = NULL;
int str_size;
+ if (iter == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot initialize NULL iterator\n");
+ return -EINVAL;
+ }
+
+ if (devargs_str == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot initialize iterator from NULL device description string\n");
+ return -EINVAL;
+ }
+
memset(iter, 0, sizeof(*iter));
memset(&devargs, 0, sizeof(devargs));
uint16_t
rte_eth_iterator_next(struct rte_dev_iterator *iter)
{
+ if (iter == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get next device from NULL iterator\n");
+ return RTE_MAX_ETHPORTS;
+ }
+
if (iter->cls == NULL) /* invalid ethdev iterator */
return RTE_MAX_ETHPORTS;
void
rte_eth_iterator_cleanup(struct rte_dev_iterator *iter)
{
+ if (iter == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot do clean up from NULL iterator\n");
+ return;
+ }
+
if (iter->bus_str == NULL)
return; /* nothing to free in pure class filter */
free(RTE_CAST_FIELD(iter, bus_str, char *)); /* workaround const */
int
rte_eth_dev_owner_new(uint64_t *owner_id)
{
+ if (owner_id == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot get new owner ID to NULL\n");
+ return -EINVAL;
+ }
+
eth_dev_shared_data_prepare();
rte_spinlock_lock(ð_dev_shared_data->ownership_lock);
return -ENODEV;
}
+ if (new_owner == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot set ethdev port %u owner from NULL owner\n",
+ port_id);
+ return -EINVAL;
+ }
+
if (!eth_is_valid_owner_id(new_owner->id) &&
!eth_is_valid_owner_id(old_owner_id)) {
RTE_ETHDEV_LOG(ERR,
int
rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner)
{
- int ret = 0;
- struct rte_eth_dev *ethdev = &rte_eth_devices[port_id];
-
- eth_dev_shared_data_prepare();
+ struct rte_eth_dev *ethdev;
- rte_spinlock_lock(ð_dev_shared_data->ownership_lock);
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ ethdev = &rte_eth_devices[port_id];
- if (port_id >= RTE_MAX_ETHPORTS || !eth_dev_is_allocated(ethdev)) {
+ if (!eth_dev_is_allocated(ethdev)) {
RTE_ETHDEV_LOG(ERR, "Port id %"PRIu16" is not allocated\n",
port_id);
- ret = -ENODEV;
- } else {
- rte_memcpy(owner, ðdev->data->owner, sizeof(*owner));
+ return -ENODEV;
+ }
+
+ if (owner == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u owner to NULL\n",
+ port_id);
+ return -EINVAL;
}
+ eth_dev_shared_data_prepare();
+
+ rte_spinlock_lock(ð_dev_shared_data->ownership_lock);
+ rte_memcpy(owner, ðdev->data->owner, sizeof(*owner));
rte_spinlock_unlock(ð_dev_shared_data->ownership_lock);
- return ret;
+
+ return 0;
}
int
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
if (name == NULL) {
- RTE_ETHDEV_LOG(ERR, "Null pointer is specified\n");
+ RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u name to NULL\n",
+ port_id);
return -EINVAL;
}
uint16_t pid;
if (name == NULL) {
- RTE_ETHDEV_LOG(ERR, "Null pointer is specified\n");
+ RTE_ETHDEV_LOG(ERR, "Cannot get port ID from NULL name");
+ return -EINVAL;
+ }
+
+ if (port_id == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get port ID to NULL for %s\n", name);
return -EINVAL;
}
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
if (!dev->data->dev_started) {
RTE_ETHDEV_LOG(ERR,
"Port %u must be started before start any queue\n",
return 0;
}
- return eth_err(port_id, dev->dev_ops->rx_queue_start(dev,
- rx_queue_id));
-
+ return eth_err(port_id, dev->dev_ops->rx_queue_start(dev, rx_queue_id));
}
int
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
ret = eth_dev_validate_rx_queue(dev, rx_queue_id);
}
return eth_err(port_id, dev->dev_ops->rx_queue_stop(dev, rx_queue_id));
-
}
int
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
if (!dev->data->dev_started) {
RTE_ETHDEV_LOG(ERR,
"Port %u must be started before start any queue\n",
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
ret = eth_dev_validate_tx_queue(dev, tx_queue_id);
}
return eth_err(port_id, dev->dev_ops->tx_queue_stop(dev, tx_queue_id));
-
}
static int
uint16_t old_mtu;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+ if (dev_conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot configure ethdev port %u from NULL config\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
if (dev->data->dev_started) {
int ret, ret_stop;
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->dev_start, -ENOTSUP);
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->dev_set_link_up, -ENOTSUP);
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->dev_set_link_down, -ENOTSUP);
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0);
-
dev = &rte_eth_devices[port_id];
if (dev->state == RTE_ETH_DEV_REMOVED)
void **rxq;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
if (rx_queue_id >= dev->data->nb_rx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", rx_queue_id);
return -EINVAL;
int count;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
if (rx_queue_id >= dev->data->nb_rx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", rx_queue_id);
return -EINVAL;
}
+
+ if (conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot setup ethdev port %u Rx hairpin queue from NULL config\n",
+ port_id);
+ return -EINVAL;
+ }
+
ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
if (ret != 0)
return ret;
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
if (tx_queue_id >= dev->data->nb_tx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", tx_queue_id);
return -EINVAL;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
if (tx_queue_id >= dev->data->nb_tx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", tx_queue_id);
return -EINVAL;
}
+
+ if (conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot setup ethdev port %u Tx hairpin queue from NULL config\n",
+ port_id);
+ return -EINVAL;
+ }
+
ret = rte_eth_dev_hairpin_capability_get(port_id, &cap);
if (ret != 0)
return ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(tx_port, -ENODEV);
dev = &rte_eth_devices[tx_port];
+
if (dev->data->dev_started == 0) {
RTE_ETHDEV_LOG(ERR, "Tx port %d is not started\n", tx_port);
return -EBUSY;
RTE_ETH_VALID_PORTID_OR_ERR_RET(tx_port, -ENODEV);
dev = &rte_eth_devices[tx_port];
+
if (dev->data->dev_started == 0) {
RTE_ETHDEV_LOG(ERR, "Tx port %d is already stopped\n", tx_port);
return -EBUSY;
struct rte_eth_dev *dev;
int ret;
- if (peer_ports == NULL || len == 0)
- return -EINVAL;
-
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
+ if (peer_ports == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u hairpin peer ports to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
+ if (len == 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u hairpin peer ports to array with zero size\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_get_peer_ports,
-ENOTSUP);
rte_eth_tx_buffer_set_err_callback(struct rte_eth_dev_tx_buffer *buffer,
buffer_tx_error_fn cbfn, void *userdata)
{
+ if (buffer == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot set Tx buffer error callback to NULL buffer\n");
+ return -EINVAL;
+ }
+
buffer->error_callback = cbfn;
buffer->error_userdata = userdata;
return 0;
{
int ret = 0;
- if (buffer == NULL)
+ if (buffer == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot initialize NULL buffer\n");
return -EINVAL;
+ }
buffer->size = size;
if (buffer->error_callback == NULL) {
int
rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
{
- struct rte_eth_dev *dev = &rte_eth_devices[port_id];
+ struct rte_eth_dev *dev;
int ret;
- /* Validate Input Data. Bail if not valid or not supported. */
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->tx_done_cleanup, -ENOTSUP);
/* Call driver to free pending mbufs. */
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
return dev->data->promiscuous;
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
return dev->data->all_multicast;
}
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
- if (dev->data->dev_conf.intr_conf.lsc &&
- dev->data->dev_started)
+ if (eth_link == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u link to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
+ if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
rte_eth_linkstatus_get(dev, eth_link);
else {
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
- if (dev->data->dev_conf.intr_conf.lsc &&
- dev->data->dev_started)
+ if (eth_link == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u link to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
+ if (dev->data->dev_conf.intr_conf.lsc && dev->data->dev_started)
rte_eth_linkstatus_get(dev, eth_link);
else {
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
int
rte_eth_link_to_str(char *str, size_t len, const struct rte_eth_link *eth_link)
{
+ if (str == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot convert link to NULL string\n");
+ return -EINVAL;
+ }
+
+ if (len == 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot convert link to string with zero size\n");
+ return -EINVAL;
+ }
+
+ if (eth_link == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot convert to string from NULL link\n");
+ return -EINVAL;
+ }
+
if (eth_link->link_status == ETH_LINK_DOWN)
return snprintf(str, len, "Link down");
else
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
+ if (stats == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u stats to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
memset(stats, 0, sizeof(*stats));
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->stats_get, -ENOTSUP);
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
- if (!id) {
- RTE_ETHDEV_LOG(ERR, "Id pointer is NULL\n");
+ if (xstat_name == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u xstats ID from NULL xstat name\n",
+ port_id);
return -ENOMEM;
}
- if (!xstat_name) {
- RTE_ETHDEV_LOG(ERR, "xstat_name pointer is NULL\n");
+ if (id == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u xstats ID to NULL\n",
+ port_id);
return -ENOMEM;
}
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
ret = eth_dev_get_xstats_count(port_id);
if (ret < 0)
return ret;
expected_entries = (uint16_t)ret;
struct rte_eth_xstat xstats[expected_entries];
- dev = &rte_eth_devices[port_id];
basic_count = eth_dev_get_xstats_basic_count(dev);
/* Return max number of stats if no ids given */
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
nb_rxqs = RTE_MIN(dev->data->nb_rx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS);
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->queue_stats_mapping_set, -ENOTSUP);
-
if (is_rx && (queue_id >= dev->data->nb_rx_queues))
return -EINVAL;
if (stat_idx >= RTE_ETHDEV_QUEUE_STAT_CNTRS)
return -EINVAL;
- return (*dev->dev_ops->queue_stats_mapping_set)
- (dev, queue_id, stat_idx, is_rx);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->queue_stats_mapping_set, -ENOTSUP);
+ return (*dev->dev_ops->queue_stats_mapping_set) (dev, queue_id, stat_idx, is_rx);
}
-
int
rte_eth_dev_set_tx_queue_stats_mapping(uint16_t port_id, uint16_t tx_queue_id,
uint8_t stat_idx)
stat_idx, STAT_QMAP_TX));
}
-
int
rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, uint16_t rx_queue_id,
uint8_t stat_idx)
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+ if (fw_version == NULL && fw_size > 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u FW version to NULL when string size is non zero\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fw_version_get, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->fw_version_get)(dev,
fw_version, fw_size));
};
int diag;
+ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (dev_info == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u info to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
/*
* Init dev_info before port_id check since caller does not have
* return status and does not know if get is successful or not.
memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
dev_info->switch_info.domain_id = RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID;
- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
- dev = &rte_eth_devices[port_id];
-
dev_info->rx_desc_lim = lim;
dev_info->tx_desc_lim = lim;
dev_info->device = dev->device;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
+ if (ptypes == NULL && num > 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u supported packet types to NULL when array size is non zero\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_supported_ptypes_get, 0);
all_ptypes = (*dev->dev_ops->dev_supported_ptypes_get)(dev);
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
- if (num > 0 && set_ptypes == NULL)
+ if (num > 0 && set_ptypes == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u set packet types to NULL when array size is non zero\n",
+ port_id);
return -EINVAL;
+ }
if (*dev->dev_ops->dev_supported_ptypes_get == NULL ||
*dev->dev_ops->dev_ptypes_set == NULL) {
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
+ if (mac_addr == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u MAC address to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
rte_ether_addr_copy(&dev->data->mac_addrs[0], mac_addr);
return 0;
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
+ if (mtu == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u MTU to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
*mtu = dev->data->mtu;
return 0;
}
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
if (!(dev->data->dev_conf.rxmode.offloads &
DEV_RX_OFFLOAD_VLAN_FILTER)) {
RTE_ETHDEV_LOG(ERR, "Port %u: vlan-filtering disabled\n",
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
if (rx_queue_id >= dev->data->nb_rx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid rx_queue_id=%u\n", rx_queue_id);
return -EINVAL;
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->vlan_tpid_set, -ENOTSUP);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_tpid_set, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->vlan_tpid_set)(dev, vlan_type,
tpid));
}
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->vlan_pvid_set, -ENOTSUP);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_pvid_set, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->vlan_pvid_set)(dev, pvid, on));
}
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
+ if (fc_conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u flow control config to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_get, -ENOTSUP);
memset(fc_conf, 0, sizeof(*fc_conf));
return eth_err(port_id, (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf));
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (fc_conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot set ethdev port %u flow control from NULL config\n",
+ port_id);
+ return -EINVAL;
+ }
+
if ((fc_conf->send_xon != 0) && (fc_conf->send_xon != 1)) {
RTE_ETHDEV_LOG(ERR, "Invalid send_xon, only 0/1 allowed\n");
return -EINVAL;
}
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->flow_ctrl_set, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->flow_ctrl_set)(dev, fc_conf));
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (pfc_conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot set ethdev port %u priority flow control from NULL config\n",
+ port_id);
+ return -EINVAL;
+ }
+
if (pfc_conf->priority > (ETH_DCB_NUM_USER_PRIORITIES - 1)) {
RTE_ETHDEV_LOG(ERR, "Invalid priority, only 0-7 allowed\n");
return -EINVAL;
}
- dev = &rte_eth_devices[port_id];
/* High water, low water validation are device specific */
if (*dev->dev_ops->priority_flow_ctrl_set)
return eth_err(port_id, (*dev->dev_ops->priority_flow_ctrl_set)
{
uint16_t i, num;
- if (!reta_conf)
- return -EINVAL;
-
num = (reta_size + RTE_RETA_GROUP_SIZE - 1) / RTE_RETA_GROUP_SIZE;
for (i = 0; i < num; i++) {
if (reta_conf[i].mask)
{
uint16_t i, idx, shift;
- if (!reta_conf)
- return -EINVAL;
-
if (max_rxq == 0) {
RTE_ETHDEV_LOG(ERR, "No receive queue is available\n");
return -EINVAL;
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (reta_conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot update ethdev port %u RSS RETA to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
+ if (reta_size == 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot update ethdev port %u RSS RETA with zero size\n",
+ port_id);
+ return -EINVAL;
+ }
+
/* Check mask bits */
ret = eth_check_reta_mask(reta_conf, reta_size);
if (ret < 0)
return ret;
- dev = &rte_eth_devices[port_id];
-
/* Check entry value */
ret = eth_check_reta_entry(reta_conf, reta_size,
dev->data->nb_rx_queues);
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (reta_conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot query ethdev port %u RSS RETA from NULL config\n",
+ port_id);
+ return -EINVAL;
+ }
/* Check mask bits */
ret = eth_check_reta_mask(reta_conf, reta_size);
if (ret < 0)
return ret;
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_query, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->reta_query)(dev, reta_conf,
reta_size));
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (rss_conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot update ethdev port %u RSS hash from NULL config\n",
+ port_id);
+ return -EINVAL;
+ }
ret = rte_eth_dev_info_get(port_id, &dev_info);
if (ret != 0)
return ret;
rss_conf->rss_hf = rte_eth_rss_hf_refine(rss_conf->rss_hf);
-
- dev = &rte_eth_devices[port_id];
if ((dev_info.flow_type_rss_offloads | rss_conf->rss_hf) !=
dev_info.flow_type_rss_offloads) {
RTE_ETHDEV_LOG(ERR,
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
+ if (rss_conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u RSS hash config to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_conf_get, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->rss_hash_conf_get)(dev,
rss_conf));
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
if (udp_tunnel == NULL) {
- RTE_ETHDEV_LOG(ERR, "Invalid udp_tunnel parameter\n");
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot add ethdev port %u UDP tunnel port from NULL UDP tunnel\n",
+ port_id);
return -EINVAL;
}
return -EINVAL;
}
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->udp_tunnel_port_add, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->udp_tunnel_port_add)(dev,
udp_tunnel));
dev = &rte_eth_devices[port_id];
if (udp_tunnel == NULL) {
- RTE_ETHDEV_LOG(ERR, "Invalid udp_tunnel parameter\n");
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot delete ethdev port %u UDP tunnel port from NULL UDP tunnel\n",
+ port_id);
return -EINVAL;
}
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->dev_led_on, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->dev_led_on)(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->dev_led_off, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->dev_led_off)(dev));
}
struct rte_eth_dev *dev;
int ret;
- if (speed_fec_capa == NULL && num > 0)
- return -EINVAL;
-
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
+ if (speed_fec_capa == NULL && num > 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u FEC capability to NULL when array size is non zero\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get_capability, -ENOTSUP);
ret = (*dev->dev_ops->fec_get_capability)(dev, speed_fec_capa, num);
{
struct rte_eth_dev *dev;
- if (fec_capa == NULL)
- return -EINVAL;
-
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
+ if (fec_capa == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u current FEC mode to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->fec_get, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->fec_get)(dev, fec_capa));
}
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->fec_set, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->fec_set)(dev, fec_capa));
}
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
+ if (addr == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot add ethdev port %u MAC address from NULL address\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP);
if (rte_is_zero_ether_addr(addr)) {
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+
+ if (addr == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot remove ethdev port %u MAC address from NULL address\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_remove, -ENOTSUP);
index = eth_dev_get_mac_addr_index(port_id, addr);
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (addr == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot set ethdev port %u default MAC address from NULL address\n",
+ port_id);
+ return -EINVAL;
+ }
if (!rte_is_valid_assigned_ether_addr(addr))
return -EINVAL;
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_set, -ENOTSUP);
ret = (*dev->dev_ops->mac_addr_set)(dev, addr);
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
+ if (addr == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot set ethdev port %u unicast hash table from NULL address\n",
+ port_id);
+ return -EINVAL;
+ }
+
if (rte_is_zero_ether_addr(addr)) {
RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n",
port_id);
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->uc_all_hash_table_set, -ENOTSUP);
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
ret = rte_eth_dev_info_get(port_id, &dev_info);
if (ret != 0)
return ret;
- dev = &rte_eth_devices[port_id];
link = dev->data->dev_link;
if (queue_idx > dev_info.max_tx_queues) {
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
+
+ if (mirror_conf == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot set ethdev port %u mirror rule from NULL config\n",
+ port_id);
+ return -EINVAL;
+ }
+
if (mirror_conf->rule_type == 0) {
RTE_ETHDEV_LOG(ERR, "Mirror rule type can not be 0\n");
return -EINVAL;
return -EINVAL;
}
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_set, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->mirror_rule_set)(dev,
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->mirror_rule_reset, -ENOTSUP);
- return eth_err(port_id, (*dev->dev_ops->mirror_rule_reset)(dev,
- rule_id));
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mirror_rule_reset, -ENOTSUP);
+ return eth_err(port_id, (*dev->dev_ops->mirror_rule_reset)(dev, rule_id));
}
RTE_INIT(eth_dev_init_cb_lists)
uint16_t next_port;
uint16_t last_port;
- if (!cb_fn)
+ if (cb_fn == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot register ethdev port %u callback from NULL\n",
+ port_id);
return -EINVAL;
+ }
if (!rte_eth_dev_is_valid_port(port_id) && port_id != RTE_ETH_ALL) {
RTE_ETHDEV_LOG(ERR, "Invalid port_id=%d\n", port_id);
uint16_t next_port;
uint16_t last_port;
- if (!cb_fn)
+ if (cb_fn == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot unregister ethdev port %u callback from NULL\n",
+ port_id);
return -EINVAL;
+ }
if (!rte_eth_dev_is_valid_port(port_id) && port_id != RTE_ETH_ALL) {
RTE_ETHDEV_LOG(ERR, "Invalid port_id=%d\n", port_id);
int rc;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
if (!dev->intr_handle) {
int fd;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1);
-
dev = &rte_eth_devices[port_id];
if (queue_id >= dev->data->nb_rx_queues) {
int rc;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
if (queue_id >= dev->data->nb_rx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", queue_id);
return -EINVAL;
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
ret = eth_dev_validate_rx_queue(dev, queue_id);
return ret;
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);
- return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_enable)(dev,
- queue_id));
+ return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id));
}
int
int ret;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
ret = eth_dev_validate_rx_queue(dev, queue_id);
return ret;
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);
- return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_disable)(dev,
- queue_id));
+ return eth_err(port_id, (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id));
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
- if (qinfo == NULL)
- return -EINVAL;
-
dev = &rte_eth_devices[port_id];
+
if (queue_id >= dev->data->nb_rx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", queue_id);
return -EINVAL;
}
+ if (qinfo == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u Rx queue %u info to NULL\n",
+ port_id, queue_id);
+ return -EINVAL;
+ }
+
if (dev->data->rx_queues == NULL ||
dev->data->rx_queues[queue_id] == NULL) {
RTE_ETHDEV_LOG(ERR,
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
- if (qinfo == NULL)
- return -EINVAL;
-
dev = &rte_eth_devices[port_id];
+
if (queue_id >= dev->data->nb_tx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id);
return -EINVAL;
}
+ if (qinfo == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot get ethdev port %u Tx queue %u info to NULL\n",
+ port_id, queue_id);
+ return -EINVAL;
+ }
+
if (dev->data->tx_queues == NULL ||
dev->data->tx_queues[queue_id] == NULL) {
RTE_ETHDEV_LOG(ERR,
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
- if (mode == NULL)
- return -EINVAL;
-
dev = &rte_eth_devices[port_id];
if (queue_id >= dev->data->nb_rx_queues) {
return -EINVAL;
}
+ if (mode == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u Rx queue %u burst mode to NULL\n",
+ port_id, queue_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_burst_mode_get, -ENOTSUP);
memset(mode, 0, sizeof(*mode));
return eth_err(port_id,
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
- if (mode == NULL)
- return -EINVAL;
-
dev = &rte_eth_devices[port_id];
if (queue_id >= dev->data->nb_tx_queues) {
return -EINVAL;
}
+ if (mode == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u Tx queue %u burst mode to NULL\n",
+ port_id, queue_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_burst_mode_get, -ENOTSUP);
memset(mode, 0, sizeof(*mode));
return eth_err(port_id,
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->get_monitor_addr, -ENOTSUP);
-
if (queue_id >= dev->data->nb_rx_queues) {
RTE_ETHDEV_LOG(ERR, "Invalid Rx queue_id=%u\n", queue_id);
return -EINVAL;
}
if (pmc == NULL) {
- RTE_ETHDEV_LOG(ERR, "Invalid power monitor condition=%p\n",
- pmc);
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u Rx queue %u power monitor condition to NULL\n",
+ port_id, queue_id);
return -EINVAL;
}
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_monitor_addr, -ENOTSUP);
return eth_err(port_id,
- dev->dev_ops->get_monitor_addr(dev->data->rx_queues[queue_id],
- pmc));
+ dev->dev_ops->get_monitor_addr(dev->data->rx_queues[queue_id], pmc));
}
int
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->set_mc_addr_list, -ENOTSUP);
return eth_err(port_id, dev->dev_ops->set_mc_addr_list(dev,
mc_addr_set, nb_mc_addr));
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+ if (timestamp == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot read ethdev port %u Rx timestamp to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_rx_timestamp, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->timesync_read_rx_timestamp)
(dev, timestamp, flags));
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+ if (timestamp == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot read ethdev port %u Tx timestamp to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_tx_timestamp, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->timesync_read_tx_timestamp)
(dev, timestamp));
dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_adjust_time, -ENOTSUP);
- return eth_err(port_id, (*dev->dev_ops->timesync_adjust_time)(dev,
- delta));
+ return eth_err(port_id, (*dev->dev_ops->timesync_adjust_time)(dev, delta));
}
int
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+ if (timestamp == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot read ethdev port %u timesync time to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_read_time, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->timesync_read_time)(dev,
timestamp));
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+ if (timestamp == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot write ethdev port %u timesync from NULL time\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->timesync_write_time, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->timesync_write_time)(dev,
timestamp));
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
dev = &rte_eth_devices[port_id];
+ if (clock == NULL) {
+ RTE_ETHDEV_LOG(ERR, "Cannot read ethdev port %u clock to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->read_clock, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->read_clock)(dev, clock));
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
- if (info == NULL)
+ dev = &rte_eth_devices[port_id];
+
+ if (info == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u register info to NULL\n",
+ port_id);
return -EINVAL;
+ }
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->get_reg)(dev, 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->get_eeprom_length, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->get_eeprom_length)(dev));
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
- if (info == NULL)
+ dev = &rte_eth_devices[port_id];
+
+ if (info == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u EEPROM info to NULL\n",
+ port_id);
return -EINVAL;
+ }
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_eeprom, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->get_eeprom)(dev, info));
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
- if (info == NULL)
+ dev = &rte_eth_devices[port_id];
+
+ if (info == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot set ethdev port %u EEPROM from NULL info\n",
+ port_id);
return -EINVAL;
+ }
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->set_eeprom, -ENOTSUP);
return eth_err(port_id, (*dev->dev_ops->set_eeprom)(dev, info));
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
- if (modinfo == NULL)
+ dev = &rte_eth_devices[port_id];
+
+ if (modinfo == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u EEPROM module info to NULL\n",
+ port_id);
return -EINVAL;
+ }
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_info, -ENOTSUP);
return (*dev->dev_ops->get_module_info)(dev, modinfo);
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
- if (info == NULL || info->data == NULL || info->length == 0)
+ dev = &rte_eth_devices[port_id];
+
+ if (info == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u module EEPROM info to NULL\n",
+ port_id);
return -EINVAL;
+ }
+
+ if (info->data == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u module EEPROM data to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
+ if (info->length == 0) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u module EEPROM to data with zero size\n",
+ port_id);
+ return -EINVAL;
+ }
- dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_module_eeprom, -ENOTSUP);
return (*dev->dev_ops->get_module_eeprom)(dev, info);
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
+ if (dcb_info == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u DCB info to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_dcb_info, -ENOTSUP);
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
-
dev = &rte_eth_devices[port_id];
+
+ if (cap == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot get ethdev port %u hairpin capability to NULL\n",
+ port_id);
+ return -EINVAL;
+ }
+
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->hairpin_cap_get, -ENOTSUP);
memset(cap, 0, sizeof(*cap));
return eth_err(port_id, (*dev->dev_ops->hairpin_cap_get)(dev, cap));
int
rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id)
{
- if (dev->data->rx_queue_state[queue_id] ==
- RTE_ETH_QUEUE_STATE_HAIRPIN)
+ if (dev->data->rx_queue_state[queue_id] == RTE_ETH_QUEUE_STATE_HAIRPIN)
return 1;
return 0;
}
int
rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id)
{
- if (dev->data->tx_queue_state[queue_id] ==
- RTE_ETH_QUEUE_STATE_HAIRPIN)
+ if (dev->data->tx_queue_state[queue_id] == RTE_ETH_QUEUE_STATE_HAIRPIN)
return 1;
return 0;
}
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ dev = &rte_eth_devices[port_id];
- if (pool == NULL)
+ if (pool == NULL) {
+ RTE_ETHDEV_LOG(ERR,
+ "Cannot test ethdev port %u mempool operation from NULL pool\n",
+ port_id);
return -EINVAL;
-
- dev = &rte_eth_devices[port_id];
+ }
if (*dev->dev_ops->pool_ops_supported == NULL)
return 1; /* all pools are supported */
dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->representor_info_get, -ENOTSUP);
- return eth_err(port_id, (*dev->dev_ops->representor_info_get)(dev,
- info));
+ return eth_err(port_id, (*dev->dev_ops->representor_info_get)(dev, info));
}
RTE_LOG_REGISTER(rte_eth_dev_logtype, lib.ethdev, INFO);