Add support for zxdh infos get. Signed-off-by: Junlong Wang --- drivers/net/zxdh/zxdh_ethdev.c | 44 +++++++++++++++++++++++++++++++++- drivers/net/zxdh/zxdh_ethdev.h | 3 +++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/net/zxdh/zxdh_ethdev.c b/drivers/net/zxdh/zxdh_ethdev.c index 5963aed949..bf0d9b7b3a 100644 --- a/drivers/net/zxdh/zxdh_ethdev.c +++ b/drivers/net/zxdh/zxdh_ethdev.c @@ -25,6 +25,43 @@ uint16_t zxdh_vport_to_vfid(union zxdh_virport_num v) return (v.epid * 8 + v.pfid) + 1152; } +static int32_t zxdh_dev_infos_get(struct rte_eth_dev *dev, + struct rte_eth_dev_info *dev_info) +{ + struct zxdh_hw *hw = dev->data->dev_private; + + dev_info->speed_capa = rte_eth_speed_bitflag(hw->speed, RTE_ETH_LINK_FULL_DUPLEX); + dev_info->max_rx_queues = RTE_MIN(hw->max_queue_pairs, ZXDH_RX_QUEUES_MAX); + dev_info->max_tx_queues = RTE_MIN(hw->max_queue_pairs, ZXDH_TX_QUEUES_MAX); + dev_info->min_rx_bufsize = ZXDH_MIN_RX_BUFSIZE; + dev_info->max_rx_pktlen = ZXDH_MAX_RX_PKTLEN; + dev_info->max_mac_addrs = ZXDH_MAX_MAC_ADDRS; + dev_info->rx_offload_capa = (RTE_ETH_RX_OFFLOAD_VLAN_STRIP | + RTE_ETH_RX_OFFLOAD_VLAN_FILTER | + RTE_ETH_RX_OFFLOAD_QINQ_STRIP); + dev_info->rx_offload_capa |= (RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | + RTE_ETH_RX_OFFLOAD_UDP_CKSUM | + RTE_ETH_RX_OFFLOAD_TCP_CKSUM | + RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM); + dev_info->rx_offload_capa |= (RTE_ETH_RX_OFFLOAD_SCATTER); + dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TCP_LRO; + dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_RSS_HASH; + + dev_info->tx_offload_capa = (RTE_ETH_TX_OFFLOAD_MULTI_SEGS); + dev_info->tx_offload_capa |= (RTE_ETH_TX_OFFLOAD_TCP_TSO | + RTE_ETH_TX_OFFLOAD_UDP_TSO); + dev_info->tx_offload_capa |= (RTE_ETH_TX_OFFLOAD_VLAN_INSERT | + RTE_ETH_TX_OFFLOAD_QINQ_INSERT | + RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO); + dev_info->tx_offload_capa |= (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | + RTE_ETH_TX_OFFLOAD_UDP_CKSUM | + RTE_ETH_TX_OFFLOAD_TCP_CKSUM | + RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM | + RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM); + + return 0; +} + static void zxdh_queues_unbind_intr(struct rte_eth_dev *dev) { struct zxdh_hw *hw = dev->data->dev_private; @@ -320,6 +357,11 @@ static int32_t zxdh_configure_intr(struct rte_eth_dev *dev) return ret; } +/* dev_ops for zxdh, bare necessities for basic operation */ +static const struct eth_dev_ops zxdh_eth_dev_ops = { + .dev_infos_get = zxdh_dev_infos_get, +}; + static int32_t zxdh_init_device(struct rte_eth_dev *eth_dev) { struct zxdh_hw *hw = eth_dev->data->dev_private; @@ -376,7 +418,7 @@ static int zxdh_eth_dev_init(struct rte_eth_dev *eth_dev) struct zxdh_hw *hw = eth_dev->data->dev_private; int ret = 0; - eth_dev->dev_ops = NULL; + eth_dev->dev_ops = &zxdh_eth_dev_ops; /* Allocate memory for storing MAC addresses */ eth_dev->data->mac_addrs = rte_zmalloc("zxdh_mac", diff --git a/drivers/net/zxdh/zxdh_ethdev.h b/drivers/net/zxdh/zxdh_ethdev.h index 0a7b574477..78f5ca6c00 100644 --- a/drivers/net/zxdh/zxdh_ethdev.h +++ b/drivers/net/zxdh/zxdh_ethdev.h @@ -33,6 +33,9 @@ extern "C" { #define ZXDH_RX_QUEUES_MAX 128U #define ZXDH_TX_QUEUES_MAX 128U +#define ZXDH_MIN_RX_BUFSIZE 64 +#define ZXDH_MAX_RX_PKTLEN 14000U + union zxdh_virport_num { uint16_t vport; struct { -- 2.27.0