[PATCH v4 07/15] net/xsc: add ethdev configure and RSS ops
WanRenyong
wanry at yunsilicon.com
Mon Jan 6 03:20:29 CET 2025
On 2025/1/4 3:14, Stephen Hemminger wrote:
> On Fri, 03 Jan 2025 23:04:19 +0800
> "WanRenyong" <wanry at yunsilicon.com> wrote:
>
>> +static int
>> +xsc_ethdev_rss_hash_conf_get(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf)
>> +{
>> + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
>> +
>> + if (!rss_conf) {
>> + rte_errno = EINVAL;
>> + return -rte_errno;
>> + }
> The parameter rss_conf is already checked for null in rte_eth_dev_rss_hash_conf_get().
will remove rss_conf check in the next version.
>
>> +static int
>> +xsc_ethdev_rss_hash_update(struct rte_eth_dev *dev,
>> + struct rte_eth_rss_conf *rss_conf)
>> +{
>> + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
>> + int ret = 0;
>> +
>> + if (rss_conf->rss_key_len > XSC_RSS_HASH_KEY_LEN || rss_conf->rss_key == NULL) {
>> + PMD_DRV_LOG(ERR, "Xsc pmd key len is %d bigger than %d",
>> + rss_conf->rss_key_len, XSC_RSS_HASH_KEY_LEN);
>> + return -EINVAL;
>> + }
> Key length is already validated against value returned from dev_info.hash_key_size before
> this is called by rte_eth_dev_rss_hash_update().
will remove the key length validation in the next version.
>> +static int
>> +xsc_ethdev_configure(struct rte_eth_dev *dev)
>> +{
>> + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev);
>> + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
>> + int ret;
>> + struct rte_eth_rss_conf *rss_conf;
>> +
>> + priv->num_sq = dev->data->nb_tx_queues;
>> + priv->num_rq = dev->data->nb_rx_queues;
>> +
>> + if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)
>> + dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH;
>> +
>> + if (priv->rss_conf.rss_key == NULL) {
>> + priv->rss_conf.rss_key = rte_zmalloc(NULL, XSC_RSS_HASH_KEY_LEN,
>> + RTE_CACHE_LINE_SIZE);
>> + if (priv->rss_conf.rss_key == NULL) {
>> + PMD_DRV_LOG(ERR, "Failed to alloc rss key");
>> + rte_errno = ENOMEM;
>> + ret = -rte_errno;
>> + goto error;
>> + }
>> + priv->rss_conf.rss_key_len = XSC_RSS_HASH_KEY_LEN;
>> + }
>> +
>> + if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key != NULL) {
>> + rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf;
>> + ret = xsc_ethdev_rss_hash_update(dev, rss_conf);
>> + if (ret != 0) {
>> + PMD_DRV_LOG(ERR, "Xsc pmd set rss key error!");
>> + rte_errno = -ENOEXEC;
>> + goto error;
>> + }
>> + }
>> +
>> + if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER) {
>> + PMD_DRV_LOG(ERR, "Xsc pmd do not support vlan filter now!");
>> + rte_errno = EINVAL;
>> + goto error;
>> + }
>> +
>> + if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP) {
>> + PMD_DRV_LOG(ERR, "Xsc pmd do not support vlan strip now!");
>> + rte_errno = EINVAL;
>> + goto error;
>> + }
> These offload flags are already validated against rx_offload_capa by rte_eth_dev_configure().
will remove these offload flags validation in the next version.
>
>
--
Thanks,
WanRenyong
More information about the dev
mailing list