drivers/net/ethernet/intel/i40e/i40e_adminq.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/i40e/i40e_adminq.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/intel/i40e/i40e_adminq.c
Extension
.c
Size
31562 bytes
Lines
1152
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (i40e_is_aq_api_ver_ge(hw, 1, 5)) {
			/* Supported in FW API version higher than 1.4 */
			set_bit(I40E_HW_CAP_GENEVE_OFFLOAD, hw->caps);
		}
		if (i40e_is_fw_ver_lt(hw, 4, 33)) {
			set_bit(I40E_HW_CAP_RESTART_AUTONEG, hw->caps);
			/* No DCB support  for FW < v4.33 */
			set_bit(I40E_HW_CAP_NO_DCB_SUPPORT, hw->caps);
		}
		if (i40e_is_fw_ver_lt(hw, 4, 3)) {
			/* Disable FW LLDP if FW < v4.3 */
			set_bit(I40E_HW_CAP_STOP_FW_LLDP, hw->caps);
		}
		if (i40e_is_fw_ver_ge(hw, 4, 40)) {
			/* Use the FW Set LLDP MIB API if FW >= v4.40 */
			set_bit(I40E_HW_CAP_USE_SET_LLDP_MIB, hw->caps);
		}
		if (i40e_is_fw_ver_ge(hw, 6, 0)) {
			/* Enable PTP L4 if FW > v6.0 */
			set_bit(I40E_HW_CAP_PTP_L4, hw->caps);
		}
		break;
	case I40E_MAC_X722:
		set_bit(I40E_HW_CAP_AQ_SRCTL_ACCESS_ENABLE, hw->caps);
		set_bit(I40E_HW_CAP_NVM_READ_REQUIRES_LOCK, hw->caps);
		set_bit(I40E_HW_CAP_RSS_AQ, hw->caps);
		set_bit(I40E_HW_CAP_128_QP_RSS, hw->caps);
		set_bit(I40E_HW_CAP_ATR_EVICT, hw->caps);
		set_bit(I40E_HW_CAP_WB_ON_ITR, hw->caps);
		set_bit(I40E_HW_CAP_MULTI_TCP_UDP_RSS_PCTYPE, hw->caps);
		set_bit(I40E_HW_CAP_NO_PCI_LINK_CHECK, hw->caps);
		set_bit(I40E_HW_CAP_USE_SET_LLDP_MIB, hw->caps);
		set_bit(I40E_HW_CAP_GENEVE_OFFLOAD, hw->caps);
		set_bit(I40E_HW_CAP_PTP_L4, hw->caps);
		set_bit(I40E_HW_CAP_WOL_MC_MAGIC_PKT_WAKE, hw->caps);
		set_bit(I40E_HW_CAP_OUTER_UDP_CSUM, hw->caps);

		if (rd32(hw, I40E_GLQF_FDEVICTENA(1)) !=
		    I40E_FDEVICT_PCTYPE_DEFAULT) {
			hw_warn(hw, "FD EVICT PCTYPES are not right, disable FD HW EVICT\n");
			clear_bit(I40E_HW_CAP_ATR_EVICT, hw->caps);
		}

		if (i40e_is_aq_api_ver_ge(hw, 1,
					  I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722))
			set_bit(I40E_HW_CAP_FW_LLDP_STOPPABLE, hw->caps);

		if (i40e_is_aq_api_ver_ge(hw, 1,
					  I40E_MINOR_VER_GET_LINK_INFO_X722))
			set_bit(I40E_HW_CAP_AQ_PHY_ACCESS, hw->caps);

		if (i40e_is_aq_api_ver_ge(hw, 1,
					  I40E_MINOR_VER_FW_REQUEST_FEC_X722))
			set_bit(I40E_HW_CAP_X722_FEC_REQUEST, hw->caps);

		fallthrough;
	default:
		break;
	}

	/* Newer versions of firmware require lock when reading the NVM */
	if (i40e_is_aq_api_ver_ge(hw, 1, 5))
		set_bit(I40E_HW_CAP_NVM_READ_REQUIRES_LOCK, hw->caps);

	/* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */
	if (i40e_is_aq_api_ver_ge(hw, 1, 7))
		set_bit(I40E_HW_CAP_802_1AD, hw->caps);

	if (i40e_is_aq_api_ver_ge(hw, 1, 8))
		set_bit(I40E_HW_CAP_FW_LLDP_PERSISTENT, hw->caps);

	if (i40e_is_aq_api_ver_ge(hw, 1, 9))
		set_bit(I40E_HW_CAP_AQ_PHY_ACCESS_EXTENDED, hw->caps);
}

/**
 *  i40e_init_adminq - main initialization routine for Admin Queue
 *  @hw: pointer to the hardware structure
 *
 *  Prior to calling this function, drivers *MUST* set the following fields
 *  in the hw->aq structure:
 *     - hw->aq.num_asq_entries
 *     - hw->aq.num_arq_entries
 *     - hw->aq.arq_buf_size
 *     - hw->aq.asq_buf_size
 **/
int i40e_init_adminq(struct i40e_hw *hw)
{
	u16 cfg_ptr, oem_hi, oem_lo;
	u16 eetrack_lo, eetrack_hi;

Annotation

Implementation Notes