src/dpdk/drivers/net/failsafe/failsafe_ops.c
static int
fs_dev_infos_get(struct rte_eth_dev *dev,
		  struct rte_eth_dev_info *infos)
{
	struct sub_device *sdev;
	uint8_t i;
	int ret;

	/* Use maximum upper bounds by default */
	infos->max_rx_pktlen = UINT32_MAX;
	infos->max_rx_queues = RTE_MAX_QUEUES_PER_PORT;
	infos->max_tx_queues = RTE_MAX_QUEUES_PER_PORT;
	infos->max_mac_addrs = FAILSAFE_MAX_ETHADDR;
	infos->max_hash_mac_addrs = UINT32_MAX;
	infos->max_vfs = UINT16_MAX;
	infos->max_vmdq_pools = UINT16_MAX;
	infos->reta_size = UINT16_MAX;
	infos->hash_key_size = UINT8_MAX;

	/*
	 * Set of capabilities that can be verified upon
	 * configuring a sub-device.
	 */
	infos->rx_offload_capa =
		DEV_RX_OFFLOAD_VLAN_STRIP |
		DEV_RX_OFFLOAD_IPV4_CKSUM |
		DEV_RX_OFFLOAD_UDP_CKSUM |
		DEV_RX_OFFLOAD_TCP_CKSUM |
		DEV_RX_OFFLOAD_TCP_LRO |
		DEV_RX_OFFLOAD_QINQ_STRIP |
		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
		DEV_RX_OFFLOAD_MACSEC_STRIP |
		DEV_RX_OFFLOAD_HEADER_SPLIT |
		DEV_RX_OFFLOAD_VLAN_FILTER |
		DEV_RX_OFFLOAD_VLAN_EXTEND |
		DEV_RX_OFFLOAD_JUMBO_FRAME |
		DEV_RX_OFFLOAD_SCATTER |
		DEV_RX_OFFLOAD_TIMESTAMP |
		DEV_RX_OFFLOAD_SECURITY;

	infos->rx_queue_offload_capa =
		DEV_RX_OFFLOAD_VLAN_STRIP |
		DEV_RX_OFFLOAD_IPV4_CKSUM |
		DEV_RX_OFFLOAD_UDP_CKSUM |
		DEV_RX_OFFLOAD_TCP_CKSUM |
		DEV_RX_OFFLOAD_TCP_LRO |
		DEV_RX_OFFLOAD_QINQ_STRIP |
		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
		DEV_RX_OFFLOAD_MACSEC_STRIP |
		DEV_RX_OFFLOAD_HEADER_SPLIT |
		DEV_RX_OFFLOAD_VLAN_FILTER |
		DEV_RX_OFFLOAD_VLAN_EXTEND |
		DEV_RX_OFFLOAD_JUMBO_FRAME |
		DEV_RX_OFFLOAD_SCATTER |
		DEV_RX_OFFLOAD_TIMESTAMP |
		DEV_RX_OFFLOAD_SECURITY;

	infos->tx_offload_capa =
		DEV_TX_OFFLOAD_MULTI_SEGS |
		DEV_TX_OFFLOAD_MBUF_FAST_FREE |
		DEV_TX_OFFLOAD_IPV4_CKSUM |
		DEV_TX_OFFLOAD_UDP_CKSUM |
		DEV_TX_OFFLOAD_TCP_CKSUM |
		DEV_TX_OFFLOAD_TCP_TSO;

	infos->flow_type_rss_offloads =
		ETH_RSS_IP |
		ETH_RSS_UDP |
		ETH_RSS_TCP;
	infos->dev_capa =
		RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
		RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;

	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
		struct rte_eth_dev_info sub_info;

		ret = rte_eth_dev_info_get(PORT_ID(sdev), &sub_info);
		ret = fs_err(sdev, ret);
		if (ret != 0)
			return ret;

		fs_dev_merge_info(infos, &sub_info);
	}

	return 0;
}
/**
 * Fail-safe dev_infos_get rules:
 *
 * No sub_device:
 *   Numerables:
 *      Use the maximum possible values for any field, so as not
 *      to impede any further configuration effort.
 *   Capabilities:
 *      Limits capabilities to those that are understood by the
 *      fail-safe PMD. This understanding stems from the fail-safe
 *      being capable of verifying that the related capability is
 *      expressed within the device configuration (struct rte_eth_conf).
 *
 * At least one probed sub_device:
 *   Numerables:
 *      Uses values from the active probed sub_device
 *      The rationale here is that if any sub_device is less capable
 *      (for example concerning the number of queues) than the active
 *      sub_device, then its subsequent configuration will fail.
 *      It is impossible to foresee this failure when the failing sub_device
 *      is supposed to be plugged-in later on, so the configuration process
 *      is the single point of failure and error reporting.
 *   Capabilities:
 *      Uses a logical AND of RX capabilities among
 *      all sub_devices and the default capabilities.
 *      Uses a logical AND of TX capabilities among
 *      the active probed sub_device and the default capabilities.
 *      Uses a logical AND of device capabilities among
 *      all sub_devices and the default capabilities.
 *
 */
Fail-safe dev_infos_get rules:
No sub_device:
Numerables:
Use the maximum possible values for any field, so as not
to impede any further configuration effort.
Capabilities:
Limits capabilities to those that are understood by the
fail-safe PMD. This understanding stems from the fail-safe
being capable of verifying that the related capability is
expressed within the device configuration (struct rte_eth_conf).

At least one probed sub_device:
Numerables:
Uses values from the active probed sub_device
The rationale here is that if any sub_device is less capable
(for example concerning the number of queues) than the active
sub_device, then its subsequent configuration will fail.
It is impossible to foresee this failure when the failing sub_device
is supposed to be plugged-in later on, so the configuration process
is the single point of failure and error reporting.
Capabilities:
Uses a logical AND of RX capabilities among
all sub_devices and the default capabilities.
Uses a logical AND of TX capabilities among
the active probed sub_device and the default capabilities.
Uses a logical AND of device capabilities among
all sub_devices and the default capabilities.
Fail - safe dev_infos_get rules : No sub_device : Numerables : Use the maximum possible values for any field so as not to impede any further configuration effort . Capabilities : Limits capabilities to those that are understood by the fail - safe PMD . This understanding stems from the fail - safe being capable of verifying that the related capability is expressed within the device configuration ( struct rte_eth_conf ) . At least one probed sub_device : Numerables : Uses values from the active probed sub_device The rationale here is that if any sub_device is less capable ( for example concerning the number of queues ) than the active sub_device then its subsequent configuration will fail . It is impossible to foresee this failure when the failing sub_device is supposed to be plugged - in later on so the configuration process is the single point of failure and error reporting . Capabilities : Uses a logical AND of RX capabilities among all sub_devices and the default capabilities . Uses a logical AND of TX capabilities among the active probed sub_device and the default capabilities . Uses a logical AND of device capabilities among all sub_devices and the default capabilities .
static int
fs_dev_infos_get(struct rte_eth_dev *dev,
		  struct rte_eth_dev_info *infos)
{
	struct sub_device *sdev;
	uint8_t i;
	int ret;
	infos->max_rx_pktlen = UINT32_MAX;
	infos->max_rx_queues = RTE_MAX_QUEUES_PER_PORT;
	infos->max_tx_queues = RTE_MAX_QUEUES_PER_PORT;
	infos->max_mac_addrs = FAILSAFE_MAX_ETHADDR;
	infos->max_hash_mac_addrs = UINT32_MAX;
	infos->max_vfs = UINT16_MAX;
	infos->max_vmdq_pools = UINT16_MAX;
	infos->reta_size = UINT16_MAX;
	infos->hash_key_size = UINT8_MAX;
	infos->rx_offload_capa =
		DEV_RX_OFFLOAD_VLAN_STRIP |
		DEV_RX_OFFLOAD_IPV4_CKSUM |
		DEV_RX_OFFLOAD_UDP_CKSUM |
		DEV_RX_OFFLOAD_TCP_CKSUM |
		DEV_RX_OFFLOAD_TCP_LRO |
		DEV_RX_OFFLOAD_QINQ_STRIP |
		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
		DEV_RX_OFFLOAD_MACSEC_STRIP |
		DEV_RX_OFFLOAD_HEADER_SPLIT |
		DEV_RX_OFFLOAD_VLAN_FILTER |
		DEV_RX_OFFLOAD_VLAN_EXTEND |
		DEV_RX_OFFLOAD_JUMBO_FRAME |
		DEV_RX_OFFLOAD_SCATTER |
		DEV_RX_OFFLOAD_TIMESTAMP |
		DEV_RX_OFFLOAD_SECURITY;
	infos->rx_queue_offload_capa =
		DEV_RX_OFFLOAD_VLAN_STRIP |
		DEV_RX_OFFLOAD_IPV4_CKSUM |
		DEV_RX_OFFLOAD_UDP_CKSUM |
		DEV_RX_OFFLOAD_TCP_CKSUM |
		DEV_RX_OFFLOAD_TCP_LRO |
		DEV_RX_OFFLOAD_QINQ_STRIP |
		DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
		DEV_RX_OFFLOAD_MACSEC_STRIP |
		DEV_RX_OFFLOAD_HEADER_SPLIT |
		DEV_RX_OFFLOAD_VLAN_FILTER |
		DEV_RX_OFFLOAD_VLAN_EXTEND |
		DEV_RX_OFFLOAD_JUMBO_FRAME |
		DEV_RX_OFFLOAD_SCATTER |
		DEV_RX_OFFLOAD_TIMESTAMP |
		DEV_RX_OFFLOAD_SECURITY;
	infos->tx_offload_capa =
		DEV_TX_OFFLOAD_MULTI_SEGS |
		DEV_TX_OFFLOAD_MBUF_FAST_FREE |
		DEV_TX_OFFLOAD_IPV4_CKSUM |
		DEV_TX_OFFLOAD_UDP_CKSUM |
		DEV_TX_OFFLOAD_TCP_CKSUM |
		DEV_TX_OFFLOAD_TCP_TSO;
	infos->flow_type_rss_offloads =
		ETH_RSS_IP |
		ETH_RSS_UDP |
		ETH_RSS_TCP;
	infos->dev_capa =
		RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
		RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
		struct rte_eth_dev_info sub_info;
		ret = rte_eth_dev_info_get(PORT_ID(sdev), &sub_info);
		ret = fs_err(sdev, ret);
		if (ret != 0)
			return ret;
		fs_dev_merge_info(infos, &sub_info);
	}
	return 0;
}
static int fs_dev_infos_get ( struct rte_eth_dev * dev , struct rte_eth_dev_info * infos ) { struct sub_device * sdev ; uint8_t i ; int ret ; infos -> max_rx_pktlen = UINT32_MAX ; infos -> max_rx_queues = RTE_MAX_QUEUES_PER_PORT ; infos -> max_tx_queues = RTE_MAX_QUEUES_PER_PORT ; infos -> max_mac_addrs = FAILSAFE_MAX_ETHADDR ; infos -> max_hash_mac_addrs = UINT32_MAX ; infos -> max_vfs = UINT16_MAX ; infos -> max_vmdq_pools = UINT16_MAX ; infos -> reta_size = UINT16_MAX ; infos -> hash_key_size = UINT8_MAX ; infos -> rx_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP | DEV_RX_OFFLOAD_IPV4_CKSUM | DEV_RX_OFFLOAD_UDP_CKSUM | DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_TCP_LRO | DEV_RX_OFFLOAD_QINQ_STRIP | DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_MACSEC_STRIP | DEV_RX_OFFLOAD_HEADER_SPLIT | DEV_RX_OFFLOAD_VLAN_FILTER | DEV_RX_OFFLOAD_VLAN_EXTEND | DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_SCATTER | DEV_RX_OFFLOAD_TIMESTAMP | DEV_RX_OFFLOAD_SECURITY ; infos -> rx_queue_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP | DEV_RX_OFFLOAD_IPV4_CKSUM | DEV_RX_OFFLOAD_UDP_CKSUM | DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_TCP_LRO | DEV_RX_OFFLOAD_QINQ_STRIP | DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | DEV_RX_OFFLOAD_MACSEC_STRIP | DEV_RX_OFFLOAD_HEADER_SPLIT | DEV_RX_OFFLOAD_VLAN_FILTER | DEV_RX_OFFLOAD_VLAN_EXTEND | DEV_RX_OFFLOAD_JUMBO_FRAME | DEV_RX_OFFLOAD_SCATTER | DEV_RX_OFFLOAD_TIMESTAMP | DEV_RX_OFFLOAD_SECURITY ; infos -> tx_offload_capa = DEV_TX_OFFLOAD_MULTI_SEGS | DEV_TX_OFFLOAD_MBUF_FAST_FREE | DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_TCP_TSO ; infos -> flow_type_rss_offloads = ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP ; infos -> dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP ; FOREACH_SUBDEV_STATE ( sdev , i , dev , DEV_PROBED ) { struct rte_eth_dev_info sub_info ; ret = rte_eth_dev_info_get ( PORT_ID ( sdev ) , & sub_info ) ; ret = fs_err ( sdev , ret ) ; if ( ret != 0 ) return ret ; fs_dev_merge_info ( infos , & sub_info ) ; } return 0 ; }
Fail-safe dev_infos_get rules:
 No sub_device:
   Numerables:
      Use the maximum possible values for any field, so as not
      to impede any further configuration effort.
Fail - safe dev_infos_get rules : No sub_device : Numerables : Use the maximum possible values for any field so as not to impede any further configuration effort .
/* Use maximum upper bounds by default */ /*
	 * Set of capabilities that can be verified upon
	 * configuring a sub-device.
	 */