net/fm10k: convert to new Rx offloads API
Ethdev Rx offloads API has changed since: commit ce17eddefc20 ("ethdev: introduce Rx queue offloads API") This commit support the new Rx offloads API. Signed-off-by: Wei Dai <wei.dai@intel.com> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
parent
40a7be870e
commit
7151de0f57
@ -180,6 +180,7 @@ struct fm10k_rx_queue {
|
||||
uint8_t drop_en;
|
||||
uint8_t rx_deferred_start; /* don't start this queue in dev start. */
|
||||
uint16_t rx_ftag_en; /* indicates FTAG RX supported */
|
||||
uint64_t offloads; /* offloads of DEV_RX_OFFLOAD_* */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -60,6 +60,10 @@ static void fm10k_set_tx_function(struct rte_eth_dev *dev);
|
||||
static int fm10k_check_ftag(struct rte_devargs *devargs);
|
||||
static int fm10k_link_update(struct rte_eth_dev *dev, int wait_to_complete);
|
||||
|
||||
static void fm10k_dev_infos_get(struct rte_eth_dev *dev,
|
||||
struct rte_eth_dev_info *dev_info);
|
||||
static uint64_t fm10k_get_rx_queue_offloads_capa(struct rte_eth_dev *dev);
|
||||
static uint64_t fm10k_get_rx_port_offloads_capa(struct rte_eth_dev *dev);
|
||||
struct fm10k_xstats_name_off {
|
||||
char name[RTE_ETH_XSTATS_NAME_SIZE];
|
||||
unsigned offset;
|
||||
@ -441,11 +445,21 @@ static int
|
||||
fm10k_dev_configure(struct rte_eth_dev *dev)
|
||||
{
|
||||
int ret;
|
||||
struct rte_eth_dev_info dev_info;
|
||||
uint64_t rx_offloads = dev->data->dev_conf.rxmode.offloads;
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
|
||||
if (dev->data->dev_conf.rxmode.hw_strip_crc == 0)
|
||||
if ((rx_offloads & DEV_RX_OFFLOAD_CRC_STRIP) == 0)
|
||||
PMD_INIT_LOG(WARNING, "fm10k always strip CRC");
|
||||
|
||||
fm10k_dev_infos_get(dev, &dev_info);
|
||||
if ((rx_offloads & dev_info.rx_offload_capa) != rx_offloads) {
|
||||
PMD_DRV_LOG(ERR, "Some Rx offloads are not supported "
|
||||
"requested 0x%" PRIx64 " supported 0x%" PRIx64,
|
||||
rx_offloads, dev_info.rx_offload_capa);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
/* multipe queue mode checking */
|
||||
ret = fm10k_check_mq_mode(dev);
|
||||
if (ret != 0) {
|
||||
@ -454,6 +468,8 @@ fm10k_dev_configure(struct rte_eth_dev *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
dev->data->scattered_rx = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -756,7 +772,7 @@ fm10k_dev_rx_init(struct rte_eth_dev *dev)
|
||||
/* It adds dual VLAN length for supporting dual VLAN */
|
||||
if ((dev->data->dev_conf.rxmode.max_rx_pkt_len +
|
||||
2 * FM10K_VLAN_TAG_SIZE) > buf_size ||
|
||||
dev->data->dev_conf.rxmode.enable_scatter) {
|
||||
rxq->offloads & DEV_RX_OFFLOAD_SCATTER) {
|
||||
uint32_t reg;
|
||||
dev->data->scattered_rx = 1;
|
||||
reg = FM10K_READ_REG(hw, FM10K_SRRCTL(i));
|
||||
@ -1389,11 +1405,9 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
|
||||
dev_info->vmdq_queue_base = 0;
|
||||
dev_info->max_vmdq_pools = ETH_32_POOLS;
|
||||
dev_info->vmdq_queue_num = FM10K_MAX_QUEUES_PF;
|
||||
dev_info->rx_offload_capa =
|
||||
DEV_RX_OFFLOAD_VLAN_STRIP |
|
||||
DEV_RX_OFFLOAD_IPV4_CKSUM |
|
||||
DEV_RX_OFFLOAD_UDP_CKSUM |
|
||||
DEV_RX_OFFLOAD_TCP_CKSUM;
|
||||
dev_info->rx_queue_offload_capa = fm10k_get_rx_queue_offloads_capa(dev);
|
||||
dev_info->rx_offload_capa = fm10k_get_rx_port_offloads_capa(dev) |
|
||||
dev_info->rx_queue_offload_capa;
|
||||
dev_info->tx_offload_capa =
|
||||
DEV_TX_OFFLOAD_VLAN_INSERT |
|
||||
DEV_TX_OFFLOAD_IPV4_CKSUM |
|
||||
@ -1412,6 +1426,7 @@ fm10k_dev_infos_get(struct rte_eth_dev *dev,
|
||||
},
|
||||
.rx_free_thresh = FM10K_RX_FREE_THRESH_DEFAULT(0),
|
||||
.rx_drop_en = 0,
|
||||
.offloads = 0,
|
||||
};
|
||||
|
||||
dev_info->default_txconf = (struct rte_eth_txconf) {
|
||||
@ -1571,19 +1586,22 @@ static int
|
||||
fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask)
|
||||
{
|
||||
if (mask & ETH_VLAN_STRIP_MASK) {
|
||||
if (!dev->data->dev_conf.rxmode.hw_vlan_strip)
|
||||
if (!(dev->data->dev_conf.rxmode.offloads &
|
||||
DEV_RX_OFFLOAD_VLAN_STRIP))
|
||||
PMD_INIT_LOG(ERR, "VLAN stripping is "
|
||||
"always on in fm10k");
|
||||
}
|
||||
|
||||
if (mask & ETH_VLAN_EXTEND_MASK) {
|
||||
if (dev->data->dev_conf.rxmode.hw_vlan_extend)
|
||||
if (dev->data->dev_conf.rxmode.offloads &
|
||||
DEV_RX_OFFLOAD_VLAN_EXTEND)
|
||||
PMD_INIT_LOG(ERR, "VLAN QinQ is not "
|
||||
"supported in fm10k");
|
||||
}
|
||||
|
||||
if (mask & ETH_VLAN_FILTER_MASK) {
|
||||
if (!dev->data->dev_conf.rxmode.hw_vlan_filter)
|
||||
if (!(dev->data->dev_conf.rxmode.offloads &
|
||||
DEV_RX_OFFLOAD_VLAN_FILTER))
|
||||
PMD_INIT_LOG(ERR, "VLAN filter is always on in fm10k");
|
||||
}
|
||||
|
||||
@ -1781,6 +1799,43 @@ mempool_element_size_valid(struct rte_mempool *mp)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint64_t fm10k_get_rx_queue_offloads_capa(struct rte_eth_dev *dev)
|
||||
{
|
||||
RTE_SET_USED(dev);
|
||||
|
||||
return (uint64_t)(DEV_RX_OFFLOAD_SCATTER);
|
||||
}
|
||||
|
||||
static uint64_t fm10k_get_rx_port_offloads_capa(struct rte_eth_dev *dev)
|
||||
{
|
||||
RTE_SET_USED(dev);
|
||||
|
||||
return (uint64_t)(DEV_RX_OFFLOAD_VLAN_STRIP |
|
||||
DEV_RX_OFFLOAD_VLAN_FILTER |
|
||||
DEV_RX_OFFLOAD_IPV4_CKSUM |
|
||||
DEV_RX_OFFLOAD_UDP_CKSUM |
|
||||
DEV_RX_OFFLOAD_TCP_CKSUM |
|
||||
DEV_RX_OFFLOAD_JUMBO_FRAME |
|
||||
DEV_RX_OFFLOAD_CRC_STRIP |
|
||||
DEV_RX_OFFLOAD_HEADER_SPLIT);
|
||||
}
|
||||
|
||||
static int
|
||||
fm10k_check_rx_queue_offloads(struct rte_eth_dev *dev, uint64_t requested)
|
||||
{
|
||||
uint64_t port_offloads = dev->data->dev_conf.rxmode.offloads;
|
||||
uint64_t queue_supported = fm10k_get_rx_queue_offloads_capa(dev);
|
||||
uint64_t port_supported = fm10k_get_rx_port_offloads_capa(dev);
|
||||
|
||||
if ((requested & (queue_supported | port_supported)) != requested)
|
||||
return 0;
|
||||
|
||||
if ((port_offloads ^ requested) & port_supported)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,
|
||||
uint16_t nb_desc, unsigned int socket_id,
|
||||
@ -1794,6 +1849,18 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
|
||||
if (!fm10k_check_rx_queue_offloads(dev, conf->offloads)) {
|
||||
PMD_INIT_LOG(ERR, "%p: Rx queue offloads 0x%" PRIx64
|
||||
" don't match port offloads 0x%" PRIx64
|
||||
" or supported port offloads 0x%" PRIx64
|
||||
" or supported queue offloads 0x%" PRIx64,
|
||||
(void *)dev, conf->offloads,
|
||||
dev->data->dev_conf.rxmode.offloads,
|
||||
fm10k_get_rx_port_offloads_capa(dev),
|
||||
fm10k_get_rx_queue_offloads_capa(dev));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
/* make sure the mempool element size can account for alignment. */
|
||||
if (!mempool_element_size_valid(mp)) {
|
||||
PMD_INIT_LOG(ERR, "Error : Mempool element size is too small");
|
||||
@ -1838,6 +1905,7 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,
|
||||
q->queue_id = queue_id;
|
||||
q->tail_ptr = (volatile uint32_t *)
|
||||
&((uint32_t *)hw->hw_addr)[FM10K_RDT(queue_id)];
|
||||
q->offloads = conf->offloads;
|
||||
if (handle_rxconf(q, conf))
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -210,7 +210,7 @@ fm10k_rx_vec_condition_check(struct rte_eth_dev *dev)
|
||||
|
||||
#ifndef RTE_FM10K_RX_OLFLAGS_ENABLE
|
||||
/* whithout rx ol_flags, no VP flag report */
|
||||
if (rxmode->hw_vlan_extend != 0)
|
||||
if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
@ -219,7 +219,7 @@ fm10k_rx_vec_condition_check(struct rte_eth_dev *dev)
|
||||
return -1;
|
||||
|
||||
/* no header split support */
|
||||
if (rxmode->header_split == 1)
|
||||
if (rxmode->offloads & DEV_RX_OFFLOAD_HEADER_SPLIT)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user