RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
} while (0)
#else
RTE_LOG(ERR, PMD, "%s: " fmt, __func__, ## args); \
} while (0)
#else
-#define VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
- if (!rte_eth_dev_is_valid_port(port_id)) { \
- PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
- return retval; \
- } \
+#define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
+ if (!rte_eth_dev_is_valid_port(port_id)) { \
+ RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+ return retval; \
+ } \
-#define VALID_PORTID_OR_RET(port_id) do { \
- if (!rte_eth_dev_is_valid_port(port_id)) { \
- PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
- return; \
- } \
+#define RTE_ETH_VALID_PORTID_OR_RET(port_id) do { \
+ if (!rte_eth_dev_is_valid_port(port_id)) { \
+ RTE_PMD_DEBUG_TRACE("Invalid port_id=%d\n", port_id); \
+ return; \
+ } \
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 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;
pci_drv->name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
pci_drv->name,
(unsigned) pci_dev->id.vendor_id,
(unsigned) pci_dev->id.device_id);
"Number of RX queues requested (%u) is greater than max supported(%d)\n",
nb_rx_q, RTE_MAX_QUEUES_PER_PORT);
return -EINVAL;
}
if (nb_tx_q > RTE_MAX_QUEUES_PER_PORT) {
"Number of RX queues requested (%u) is greater than max supported(%d)\n",
nb_rx_q, RTE_MAX_QUEUES_PER_PORT);
return -EINVAL;
}
if (nb_tx_q > RTE_MAX_QUEUES_PER_PORT) {
"Number of TX queues requested (%u) is greater than max supported(%d)\n",
nb_tx_q, RTE_MAX_QUEUES_PER_PORT);
return -EINVAL;
"Number of TX queues requested (%u) is greater than max supported(%d)\n",
nb_tx_q, RTE_MAX_QUEUES_PER_PORT);
return -EINVAL;
- FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
- FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_configure, -ENOTSUP);
*/
(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
if (nb_rx_q > dev_info.max_rx_queues) {
*/
(*dev->dev_ops->dev_infos_get)(dev, &dev_info);
if (nb_rx_q > dev_info.max_rx_queues) {
if (dev_conf->rxmode.jumbo_frame == 1) {
if (dev_conf->rxmode.max_rx_pkt_len >
dev_info.max_rx_pktlen) {
if (dev_conf->rxmode.jumbo_frame == 1) {
if (dev_conf->rxmode.max_rx_pkt_len >
dev_info.max_rx_pktlen) {
" > max valid value %u\n",
port_id,
(unsigned)dev_conf->rxmode.max_rx_pkt_len,
(unsigned)dev_info.max_rx_pktlen);
return -EINVAL;
} else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) {
" > max valid value %u\n",
port_id,
(unsigned)dev_conf->rxmode.max_rx_pkt_len,
(unsigned)dev_info.max_rx_pktlen);
return -EINVAL;
} else if (dev_conf->rxmode.max_rx_pkt_len < ETHER_MIN_LEN) {
" < min valid value %u\n",
port_id,
(unsigned)dev_conf->rxmode.max_rx_pkt_len,
" < min valid value %u\n",
port_id,
(unsigned)dev_conf->rxmode.max_rx_pkt_len,
port_id, diag);
rte_eth_dev_rx_queue_config(dev, 0);
rte_eth_dev_tx_queue_config(dev, 0);
port_id, diag);
rte_eth_dev_rx_queue_config(dev, 0);
rte_eth_dev_tx_queue_config(dev, 0);
(dev->data->mac_pool_sel[i] & (1ULL << pool)))
(*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
else {
(dev->data->mac_pool_sel[i] & (1ULL << pool)))
(*dev->dev_ops->mac_addr_add)(dev, &addr, i, pool);
else {
- FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
- FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
*/
rte_eth_dev_info_get(port_id, &dev_info);
if (mp->private_data_size < sizeof(struct rte_pktmbuf_pool_private)) {
*/
rte_eth_dev_info_get(port_id, &dev_info);
if (mp->private_data_size < sizeof(struct rte_pktmbuf_pool_private)) {
mp->name, (int) mp->private_data_size,
(int) sizeof(struct rte_pktmbuf_pool_private));
return -ENOSPC;
mp->name, (int) mp->private_data_size,
(int) sizeof(struct rte_pktmbuf_pool_private));
return -ENOSPC;
mbp_buf_size = rte_pktmbuf_data_room_size(mp);
if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) < dev_info.min_rx_bufsize) {
mbp_buf_size = rte_pktmbuf_data_room_size(mp);
if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) < dev_info.min_rx_bufsize) {
"should be: <= %hu, = %hu, and a product of %hu\n",
nb_rx_desc,
dev_info.rx_desc_lim.nb_max,
"should be: <= %hu, = %hu, and a product of %hu\n",
nb_rx_desc,
dev_info.rx_desc_lim.nb_max,
- FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
- FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
+ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_queue_setup, -ENOTSUP);
rte_eth_dev_info_get(port_id, &dev_info);
if (nb_tx_desc > dev_info.tx_desc_lim.nb_max ||
nb_tx_desc < dev_info.tx_desc_lim.nb_min ||
nb_tx_desc % dev_info.tx_desc_lim.nb_align != 0) {
rte_eth_dev_info_get(port_id, &dev_info);
if (nb_tx_desc > dev_info.tx_desc_lim.nb_max ||
nb_tx_desc < dev_info.tx_desc_lim.nb_min ||
nb_tx_desc % dev_info.tx_desc_lim.nb_align != 0) {
"should be: <= %hu, = %hu, and a product of %hu\n",
nb_tx_desc,
dev_info.tx_desc_lim.nb_max,
"should be: <= %hu, = %hu, and a product of %hu\n",
nb_tx_desc,
dev_info.tx_desc_lim.nb_max,
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);
else {
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);
else {
(*dev->dev_ops->link_update)(dev, 1);
*eth_link = dev->data->dev_link;
}
(*dev->dev_ops->link_update)(dev, 1);
*eth_link = dev->data->dev_link;
}
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);
else {
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);
else {
(*dev->dev_ops->link_update)(dev, 0);
*eth_link = dev->data->dev_link;
}
(*dev->dev_ops->link_update)(dev, 0);
*eth_link = dev->data->dev_link;
}
dev = &rte_eth_devices[port_id];
memset(stats, 0, sizeof(*stats));
dev = &rte_eth_devices[port_id];
memset(stats, 0, sizeof(*stats));
(*dev->dev_ops->stats_get)(dev, stats);
stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
return 0;
(*dev->dev_ops->stats_get)(dev, stats);
stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;
return 0;
return (*dev->dev_ops->queue_stats_mapping_set)
(dev, queue_id, stat_idx, is_rx);
}
return (*dev->dev_ops->queue_stats_mapping_set)
(dev, queue_id, stat_idx, is_rx);
}
dev = &rte_eth_devices[port_id];
memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
dev_info->rx_desc_lim = lim;
dev_info->tx_desc_lim = lim;
dev = &rte_eth_devices[port_id];
memset(dev_info, 0, sizeof(struct rte_eth_dev_info));
dev_info->rx_desc_lim = lim;
dev_info->tx_desc_lim = lim;
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
dev_info->pci_dev = dev->pci_dev;
dev_info->driver_name = dev->data->drv_name;
(*dev->dev_ops->dev_infos_get)(dev, dev_info);
dev_info->pci_dev = dev->pci_dev;
dev_info->driver_name = dev->data->drv_name;
dev = &rte_eth_devices[port_id];
ether_addr_copy(&dev->data->mac_addrs[0], mac_addr);
}
dev = &rte_eth_devices[port_id];
ether_addr_copy(&dev->data->mac_addrs[0], mac_addr);
}
memset(fc_conf, 0, sizeof(*fc_conf));
return (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf);
}
memset(fc_conf, 0, sizeof(*fc_conf));
return (*dev->dev_ops->flow_ctrl_get)(dev, fc_conf);
}
shift = i % RTE_RETA_GROUP_SIZE;
if ((reta_conf[idx].mask & (1ULL << shift)) &&
(reta_conf[idx].reta[shift] >= max_rxq)) {
shift = i % RTE_RETA_GROUP_SIZE;
if ((reta_conf[idx].mask & (1ULL << shift)) &&
(reta_conf[idx].reta[shift] >= max_rxq)) {
"the maximum rxq index: %u\n", idx, shift,
reta_conf[idx].reta[shift], max_rxq);
return -EINVAL;
"the maximum rxq index: %u\n", idx, shift,
reta_conf[idx].reta[shift], max_rxq);
return -EINVAL;
rss_hash_protos = rss_conf->rss_hf;
if ((rss_hash_protos != 0) &&
((rss_hash_protos & ETH_RSS_PROTO_MASK) == 0)) {
rss_hash_protos = rss_conf->rss_hf;
if ((rss_hash_protos != 0) &&
((rss_hash_protos & ETH_RSS_PROTO_MASK) == 0)) {
/* Update default address in NIC data structure */
ether_addr_copy(addr, &dev->data->mac_addrs[0]);
/* Update default address in NIC data structure */
ether_addr_copy(addr, &dev->data->mac_addrs[0]);
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
num_vfs = dev_info.max_vfs;
if (vf > num_vfs) {
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
num_vfs = dev_info.max_vfs;
if (vf > num_vfs) {
return (*dev->dev_ops->set_vf_rx_mode)(dev, vf, rx_mode, on);
}
return (*dev->dev_ops->set_vf_rx_mode)(dev, vf, rx_mode, on);
}
"set in UTA\n", port_id);
return -EINVAL;
}
index = get_hash_mac_addr_index(port_id, &null_mac_addr);
if (index < 0) {
"set in UTA\n", port_id);
return -EINVAL;
}
index = get_hash_mac_addr_index(port_id, &null_mac_addr);
if (index < 0) {
ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
if (ret == 0) {
/* Update address in NIC data structure */
ret = (*dev->dev_ops->uc_hash_table_set)(dev, addr, on);
if (ret == 0) {
/* Update address in NIC data structure */
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
num_vfs = dev_info.max_vfs;
if (vf > num_vfs) {
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
num_vfs = dev_info.max_vfs;
if (vf > num_vfs) {
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
num_vfs = dev_info.max_vfs;
if (vf > num_vfs) {
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
num_vfs = dev_info.max_vfs;
if (vf > num_vfs) {
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
link = dev->data->dev_link;
if (queue_idx > dev_info.max_tx_queues) {
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
link = dev->data->dev_link;
if (queue_idx > dev_info.max_tx_queues) {
"invalid queue id=%d\n", port_id, queue_idx);
return -EINVAL;
}
if (tx_rate > link.link_speed) {
"invalid queue id=%d\n", port_id, queue_idx);
return -EINVAL;
}
if (tx_rate > link.link_speed) {
"bigger than link speed= %d\n",
tx_rate, link.link_speed);
return -EINVAL;
}
"bigger than link speed= %d\n",
tx_rate, link.link_speed);
return -EINVAL;
}
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
link = dev->data->dev_link;
if (vf > dev_info.max_vfs) {
dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
link = dev->data->dev_link;
if (vf > dev_info.max_vfs) {
"invalid vf id=%d\n", port_id, vf);
return -EINVAL;
}
if (tx_rate > link.link_speed) {
"invalid vf id=%d\n", port_id, vf);
return -EINVAL;
}
if (tx_rate > link.link_speed) {
"bigger than link speed= %d\n",
tx_rate, link.link_speed);
return -EINVAL;
}
"bigger than link speed= %d\n",
tx_rate, link.link_speed);
return -EINVAL;
}
return (*dev->dev_ops->set_vf_rate_limit)(dev, vf, tx_rate, q_msk);
}
return (*dev->dev_ops->set_vf_rate_limit)(dev, vf, tx_rate, q_msk);
}
if ((mirror_conf->rule_type & (ETH_MIRROR_VIRTUAL_POOL_UP |
ETH_MIRROR_VIRTUAL_POOL_DOWN)) &&
(mirror_conf->pool_mask == 0)) {
if ((mirror_conf->rule_type & (ETH_MIRROR_VIRTUAL_POOL_UP |
ETH_MIRROR_VIRTUAL_POOL_DOWN)) &&
(mirror_conf->pool_mask == 0)) {
return (*dev->dev_ops->mirror_rule_set)(dev, mirror_conf, rule_id, on);
}
return (*dev->dev_ops->mirror_rule_set)(dev, mirror_conf, rule_id, on);
}
return -ENODEV;
}
dev = &rte_eth_devices[port_id];
intr_handle = &dev->pci_dev->intr_handle;
if (!intr_handle->intr_vec) {
return -ENODEV;
}
dev = &rte_eth_devices[port_id];
intr_handle = &dev->pci_dev->intr_handle;
if (!intr_handle->intr_vec) {
vec = intr_handle->intr_vec[qid];
rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
if (rc && rc != -EEXIST) {
vec = intr_handle->intr_vec[qid];
rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
if (rc && rc != -EEXIST) {
" op %d epfd %d vec %u\n",
port_id, qid, op, epfd, vec);
}
" op %d epfd %d vec %u\n",
port_id, qid, op, epfd, vec);
}
return -EPERM;
}
vec = intr_handle->intr_vec[queue_id];
rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
if (rc && rc != -EEXIST) {
return -EPERM;
}
vec = intr_handle->intr_vec[queue_id];
rc = rte_intr_rx_ctl(intr_handle, epfd, op, vec, data);
if (rc && rc != -EEXIST) {
" op %d epfd %d vec %u\n",
port_id, queue_id, op, epfd, vec);
return rc;
" op %d epfd %d vec %u\n",
port_id, queue_id, op, epfd, vec);
return rc;
return (*dev->dev_ops->filter_ctrl)(dev, filter_type,
RTE_ETH_FILTER_NOP, NULL);
}
return (*dev->dev_ops->filter_ctrl)(dev, filter_type,
RTE_ETH_FILTER_NOP, NULL);
}
return (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op, arg);
}
return (*dev->dev_ops->filter_ctrl)(dev, filter_type, filter_op, arg);
}
memset(qinfo, 0, sizeof(*qinfo));
dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
memset(qinfo, 0, sizeof(*qinfo));
dev->dev_ops->rxq_info_get(dev, queue_id, qinfo);
memset(qinfo, 0, sizeof(*qinfo));
dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
memset(qinfo, 0, sizeof(*qinfo));
dev->dev_ops->txq_info_get(dev, queue_id, qinfo);
return -ENODEV;
}
dev = &rte_eth_devices[port_id];
memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
return -ENODEV;
}
dev = &rte_eth_devices[port_id];
memset(dcb_info, 0, sizeof(struct rte_eth_dcb_info));
rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
{
if ((eth_dev == NULL) || (pci_dev == NULL)) {
rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
{
if ((eth_dev == NULL) || (pci_dev == NULL)) {