Skip to content

Commit

Permalink
net/xsc: add ethdev infos get
Browse files Browse the repository at this point in the history
Implement xsc ethdev information get ops.

Signed-off-by: Renyong Wan <[email protected]>
  • Loading branch information
Renyong Wan authored and shemminger committed Jan 28, 2025
1 parent 7cb45d8 commit 4edac52
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions drivers/net/xsc/xsc_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,66 @@ xsc_ethdev_close(struct rte_eth_dev *dev)
return 0;
}

static uint64_t
xsc_get_rx_queue_offloads(struct rte_eth_dev *dev)
{
struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
struct xsc_dev_config *config = &priv->config;
uint64_t offloads = 0;

if (config->hw_csum)
offloads |= (RTE_ETH_RX_OFFLOAD_IPV4_CKSUM |
RTE_ETH_RX_OFFLOAD_UDP_CKSUM |
RTE_ETH_RX_OFFLOAD_TCP_CKSUM);

return offloads;
}

static uint64_t
xsc_get_tx_port_offloads(struct rte_eth_dev *dev)
{
struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
uint64_t offloads = 0;
struct xsc_dev_config *config = &priv->config;

if (config->hw_csum)
offloads |= (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
RTE_ETH_TX_OFFLOAD_UDP_CKSUM |
RTE_ETH_TX_OFFLOAD_TCP_CKSUM);
if (config->tso)
offloads |= RTE_ETH_TX_OFFLOAD_TCP_TSO;
return offloads;
}

static int
xsc_ethdev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)
{
struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);

info->min_rx_bufsize = 64;
info->max_rx_pktlen = 65536;
info->max_lro_pkt_size = 0;
info->max_rx_queues = 256;
info->max_tx_queues = 1024;
info->rx_desc_lim.nb_max = 4096;
info->rx_desc_lim.nb_min = 16;
info->tx_desc_lim.nb_max = 8192;
info->tx_desc_lim.nb_min = 128;

info->rx_queue_offload_capa = xsc_get_rx_queue_offloads(dev);
info->rx_offload_capa = info->rx_queue_offload_capa;
info->tx_offload_capa = xsc_get_tx_port_offloads(dev);

info->if_index = priv->ifindex;
info->speed_capa = priv->xdev->link_speed_capa;
info->hash_key_size = XSC_RSS_HASH_KEY_LEN;
info->tx_desc_lim.nb_seg_max = 8;
info->tx_desc_lim.nb_mtu_seg_max = 8;
info->switch_info.name = dev->data->name;
info->switch_info.port_id = priv->representor_id;
return 0;
}

static int
xsc_ethdev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
uint32_t socket, const struct rte_eth_rxconf *conf,
Expand Down Expand Up @@ -549,6 +609,7 @@ const struct eth_dev_ops xsc_eth_dev_ops = {
.dev_close = xsc_ethdev_close,
.stats_get = xsc_ethdev_stats_get,
.stats_reset = xsc_ethdev_stats_reset,
.dev_infos_get = xsc_ethdev_infos_get,
.rx_queue_setup = xsc_ethdev_rx_queue_setup,
.tx_queue_setup = xsc_ethdev_tx_queue_setup,
.rx_queue_release = xsc_ethdev_rxq_release,
Expand Down

0 comments on commit 4edac52

Please sign in to comment.