src/dpdk/drivers/net/hinic/hinic_pmd_ethdev.c
static int hinic_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
	bool on;
	int err;

	/* Enable or disable VLAN filter */
	if (mask & ETH_VLAN_FILTER_MASK) {
		on = (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER) ?
			TRUE : FALSE;
		err = hinic_config_vlan_filter(nic_dev->hwdev, on);
		if (err == HINIC_MGMT_CMD_UNSUPPORTED) {
			PMD_DRV_LOG(WARNING,
				"Current matching version does not support vlan filter configuration, device: %s, port_id: %d",
				  nic_dev->proc_dev_name, dev->data->port_id);
		} else if (err) {
			PMD_DRV_LOG(ERR, "Failed to %s vlan filter, device: %s, port_id: %d, err: %d",
				  on ? "enable" : "disable",
				  nic_dev->proc_dev_name,
				  dev->data->port_id, err);
			return err;
		}

		PMD_DRV_LOG(INFO, "%s vlan filter succeed, device: %s, port_id: %d",
			  on ? "Enable" : "Disable",
			  nic_dev->proc_dev_name, dev->data->port_id);
	}

	/* Enable or disable VLAN stripping */
	if (mask & ETH_VLAN_STRIP_MASK) {
		on = (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) ?
			TRUE : FALSE;
		err = hinic_set_rx_vlan_offload(nic_dev->hwdev, on);
		if (err) {
			PMD_DRV_LOG(ERR, "Failed to %s vlan strip, device: %s, port_id: %d, err: %d",
				  on ? "enable" : "disable",
				  nic_dev->proc_dev_name,
				  dev->data->port_id, err);
			return err;
		}

		PMD_DRV_LOG(INFO, "%s vlan strip succeed, device: %s, port_id: %d",
			  on ? "Enable" : "Disable",
			  nic_dev->proc_dev_name, dev->data->port_id);
	}

	return 0;
}
/**
 * DPDK callback to enable or disable vlan offload.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 * @param mask
 *   Definitions used for VLAN setting
 */
DPDK callback to enable or disable vlan offload.
@param dev
Pointer to Ethernet device structure.
@param mask
Definitions used for VLAN setting
DPDK callback to enable or disable vlan offload . @param dev Pointer to Ethernet device structure . @param mask Definitions used for VLAN setting
static int hinic_vlan_offload_set(struct rte_eth_dev *dev, int mask)
{
	struct hinic_nic_dev *nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
	bool on;
	int err;
	if (mask & ETH_VLAN_FILTER_MASK) {
		on = (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER) ?
			TRUE : FALSE;
		err = hinic_config_vlan_filter(nic_dev->hwdev, on);
		if (err == HINIC_MGMT_CMD_UNSUPPORTED) {
			PMD_DRV_LOG(WARNING,
				"Current matching version does not support vlan filter configuration, device: %s, port_id: %d",
				  nic_dev->proc_dev_name, dev->data->port_id);
		} else if (err) {
			PMD_DRV_LOG(ERR, "Failed to %s vlan filter, device: %s, port_id: %d, err: %d",
				  on ? "enable" : "disable",
				  nic_dev->proc_dev_name,
				  dev->data->port_id, err);
			return err;
		}
		PMD_DRV_LOG(INFO, "%s vlan filter succeed, device: %s, port_id: %d",
			  on ? "Enable" : "Disable",
			  nic_dev->proc_dev_name, dev->data->port_id);
	}
	if (mask & ETH_VLAN_STRIP_MASK) {
		on = (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) ?
			TRUE : FALSE;
		err = hinic_set_rx_vlan_offload(nic_dev->hwdev, on);
		if (err) {
			PMD_DRV_LOG(ERR, "Failed to %s vlan strip, device: %s, port_id: %d, err: %d",
				  on ? "enable" : "disable",
				  nic_dev->proc_dev_name,
				  dev->data->port_id, err);
			return err;
		}
		PMD_DRV_LOG(INFO, "%s vlan strip succeed, device: %s, port_id: %d",
			  on ? "Enable" : "Disable",
			  nic_dev->proc_dev_name, dev->data->port_id);
	}
	return 0;
}
static int hinic_vlan_offload_set ( struct rte_eth_dev * dev , int mask ) { struct hinic_nic_dev * nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV ( dev ) ; struct rte_eth_rxmode * rxmode = & dev -> data -> dev_conf . rxmode ; bool on ; int err ; if ( mask & ETH_VLAN_FILTER_MASK ) { on = ( rxmode -> offloads & DEV_RX_OFFLOAD_VLAN_FILTER ) ? TRUE : FALSE ; err = hinic_config_vlan_filter ( nic_dev -> hwdev , on ) ; if ( err == HINIC_MGMT_CMD_UNSUPPORTED ) { PMD_DRV_LOG ( WARNING , " " , nic_dev -> proc_dev_name , dev -> data -> port_id ) ; } else if ( err ) { PMD_DRV_LOG ( ERR , " " , on ? " " : " " , nic_dev -> proc_dev_name , dev -> data -> port_id , err ) ; return err ; } PMD_DRV_LOG ( INFO , " " , on ? " " : " " , nic_dev -> proc_dev_name , dev -> data -> port_id ) ; } if ( mask & ETH_VLAN_STRIP_MASK ) { on = ( rxmode -> offloads & DEV_RX_OFFLOAD_VLAN_STRIP ) ? TRUE : FALSE ; err = hinic_set_rx_vlan_offload ( nic_dev -> hwdev , on ) ; if ( err ) { PMD_DRV_LOG ( ERR , " " , on ? " " : " " , nic_dev -> proc_dev_name , dev -> data -> port_id , err ) ; return err ; } PMD_DRV_LOG ( INFO , " " , on ? " " : " " , nic_dev -> proc_dev_name , dev -> data -> port_id ) ; } return 0 ; }
DPDK callback to enable or disable vlan offload.
DPDK callback to enable or disable vlan offload .
/* Enable or disable VLAN filter */ /* Enable or disable VLAN stripping */