src/dpdk/drivers/net/hinic/hinic_pmd_ethdev.c
static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,
			      struct rte_eth_rss_reta_entry64 *reta_conf,
			      uint16_t reta_size)
{
	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
	u8 tmpl_idx = nic_dev->rss_tmpl_idx;
	u8 prio_tc[HINIC_DCB_UP_MAX] = {0};
	u32 indirtbl[NIC_RSS_INDIR_SIZE] = {0};
	int err = 0;
	u16 i = 0;
	u16 idx, shift;

	if (!(nic_dev->flags & ETH_MQ_RX_RSS_FLAG))
		return HINIC_OK;

	if (reta_size != NIC_RSS_INDIR_SIZE) {
		PMD_DRV_LOG(ERR, "Invalid reta size, reta_size: %d", reta_size);
		return HINIC_ERROR;
	}

	err = hinic_rss_get_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl);
	if (err)
		return err;

	/* update rss indir_tbl */
	for (i = 0; i < reta_size; i++) {
		idx = i / RTE_RETA_GROUP_SIZE;
		shift = i % RTE_RETA_GROUP_SIZE;

		if (reta_conf[idx].reta[shift] >= nic_dev->num_rq) {
			PMD_DRV_LOG(ERR, "Invalid reta entry, indirtbl[%d]: %d "
				"exceeds the maximum rxq num: %d", i,
				reta_conf[idx].reta[shift], nic_dev->num_rq);
			return -EINVAL;
		}

		if (reta_conf[idx].mask & (1ULL << shift))
			indirtbl[i] = reta_conf[idx].reta[shift];
	}

	err = hinic_rss_set_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl);
	if (err)
		goto disable_rss;

	nic_dev->rss_indir_flag = true;

	return 0;

disable_rss:
	memset(prio_tc, 0, sizeof(prio_tc));
	(void)hinic_rss_cfg(nic_dev->hwdev, 0, tmpl_idx, 0, prio_tc);

	return HINIC_ERROR;
}
/**
 * DPDK callback to update the RSS redirection table.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 * @param reta_conf
 *   Pointer to RSS reta configuration data.
 * @param reta_size
 *   Size of the RETA table.
 *
 * @return
 *   0 on success, negative error value otherwise.
 */
DPDK callback to update the RSS redirection table.
@param dev
Pointer to Ethernet device structure.
@param reta_conf
Pointer to RSS reta configuration data.
@param reta_size
Size of the RETA table.

@return
0 on success, negative error value otherwise.
DPDK callback to update the RSS redirection table . @param dev Pointer to Ethernet device structure . @param reta_conf Pointer to RSS reta configuration data . @param reta_size Size of the RETA table . @return 0 on success negative error value otherwise .
static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev,
			      struct rte_eth_rss_reta_entry64 *reta_conf,
			      uint16_t reta_size)
{
	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
	u8 tmpl_idx = nic_dev->rss_tmpl_idx;
	u8 prio_tc[HINIC_DCB_UP_MAX] = {0};
	u32 indirtbl[NIC_RSS_INDIR_SIZE] = {0};
	int err = 0;
	u16 i = 0;
	u16 idx, shift;
	if (!(nic_dev->flags & ETH_MQ_RX_RSS_FLAG))
		return HINIC_OK;
	if (reta_size != NIC_RSS_INDIR_SIZE) {
		PMD_DRV_LOG(ERR, "Invalid reta size, reta_size: %d", reta_size);
		return HINIC_ERROR;
	}
	err = hinic_rss_get_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl);
	if (err)
		return err;
	for (i = 0; i < reta_size; i++) {
		idx = i / RTE_RETA_GROUP_SIZE;
		shift = i % RTE_RETA_GROUP_SIZE;
		if (reta_conf[idx].reta[shift] >= nic_dev->num_rq) {
			PMD_DRV_LOG(ERR, "Invalid reta entry, indirtbl[%d]: %d "
				"exceeds the maximum rxq num: %d", i,
				reta_conf[idx].reta[shift], nic_dev->num_rq);
			return -EINVAL;
		}
		if (reta_conf[idx].mask & (1ULL << shift))
			indirtbl[i] = reta_conf[idx].reta[shift];
	}
	err = hinic_rss_set_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl);
	if (err)
		goto disable_rss;
	nic_dev->rss_indir_flag = true;
	return 0;
disable_rss:
	memset(prio_tc, 0, sizeof(prio_tc));
	(void)hinic_rss_cfg(nic_dev->hwdev, 0, tmpl_idx, 0, prio_tc);
	return HINIC_ERROR;
}
static int hinic_rss_indirtbl_update ( struct rte_eth_dev * dev , struct rte_eth_rss_reta_entry64 * reta_conf , uint16_t reta_size ) { struct hinic_nic_dev * nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV ( dev ) ; u8 tmpl_idx = nic_dev -> rss_tmpl_idx ; u8 prio_tc [ HINIC_DCB_UP_MAX ] = { 0 } ; u32 indirtbl [ NIC_RSS_INDIR_SIZE ] = { 0 } ; int err = 0 ; u16 i = 0 ; u16 idx , shift ; if ( ! ( nic_dev -> flags & ETH_MQ_RX_RSS_FLAG ) ) return HINIC_OK ; if ( reta_size != NIC_RSS_INDIR_SIZE ) { PMD_DRV_LOG ( ERR , " " , reta_size ) ; return HINIC_ERROR ; } err = hinic_rss_get_indir_tbl ( nic_dev -> hwdev , tmpl_idx , indirtbl ) ; if ( err ) return err ; for ( i = 0 ; i < reta_size ; i ++ ) { idx = i / RTE_RETA_GROUP_SIZE ; shift = i % RTE_RETA_GROUP_SIZE ; if ( reta_conf [ idx ] . reta [ shift ] >= nic_dev -> num_rq ) { PMD_DRV_LOG ( ERR , " " " " , i , reta_conf [ idx ] . reta [ shift ] , nic_dev -> num_rq ) ; return - EINVAL ; } if ( reta_conf [ idx ] . mask & ( 1ULL << shift ) ) indirtbl [ i ] = reta_conf [ idx ] . reta [ shift ] ; } err = hinic_rss_set_indir_tbl ( nic_dev -> hwdev , tmpl_idx , indirtbl ) ; if ( err ) goto disable_rss ; nic_dev -> rss_indir_flag = true ; return 0 ; disable_rss : memset ( prio_tc , 0 , sizeof ( prio_tc ) ) ; ( void ) hinic_rss_cfg ( nic_dev -> hwdev , 0 , tmpl_idx , 0 , prio_tc ) ; return HINIC_ERROR ; }
DPDK callback to update the RSS redirection table.
DPDK callback to update the RSS redirection table .
/* update rss indir_tbl */