src/dpdk/drivers/net/txgbe/base/txgbe_hw.c
s32 txgbe_set_mac_type(struct txgbe_hw *hw)
{
	s32 err = 0;

	DEBUGFUNC("txgbe_set_mac_type");

	if (hw->vendor_id != PCI_VENDOR_ID_WANGXUN) {
		DEBUGOUT("Unsupported vendor id: %x", hw->vendor_id);
		return TXGBE_ERR_DEVICE_NOT_SUPPORTED;
	}

	switch (hw->device_id) {
	case TXGBE_DEV_ID_RAPTOR_KR_KX_KX4:
		hw->phy.media_type = txgbe_media_type_backplane;
		hw->mac.type = txgbe_mac_raptor;
		break;
	case TXGBE_DEV_ID_RAPTOR_XAUI:
	case TXGBE_DEV_ID_RAPTOR_SGMII:
		hw->phy.media_type = txgbe_media_type_copper;
		hw->mac.type = txgbe_mac_raptor;
		break;
	case TXGBE_DEV_ID_RAPTOR_SFP:
	case TXGBE_DEV_ID_WX1820_SFP:
		hw->phy.media_type = txgbe_media_type_fiber;
		hw->mac.type = txgbe_mac_raptor;
		break;
	case TXGBE_DEV_ID_RAPTOR_QSFP:
		hw->phy.media_type = txgbe_media_type_fiber_qsfp;
		hw->mac.type = txgbe_mac_raptor;
		break;
	case TXGBE_DEV_ID_RAPTOR_VF:
	case TXGBE_DEV_ID_RAPTOR_VF_HV:
		hw->phy.media_type = txgbe_media_type_virtual;
		hw->mac.type = txgbe_mac_raptor_vf;
		break;
	default:
		err = TXGBE_ERR_DEVICE_NOT_SUPPORTED;
		DEBUGOUT("Unsupported device id: %x", hw->device_id);
		break;
	}

	DEBUGOUT("found mac: %d media: %d, returns: %d\n",
		  hw->mac.type, hw->phy.media_type, err);
	return err;
}
/**
 *  txgbe_set_mac_type - Sets MAC type
 *  @hw: pointer to the HW structure
 *
 *  This function sets the mac type of the adapter based on the
 *  vendor ID and device ID stored in the hw structure.
 **/
Sets MAC type
@hw: pointer to the HW structure

This function sets the mac type of the adapter based on the
vendor ID and device ID stored in the hw structure.
Sets MAC type @hw : pointer to the HW structure This function sets the mac type of the adapter based on the vendor ID and device ID stored in the hw structure .
s32 txgbe_set_mac_type(struct txgbe_hw *hw)
{
	s32 err = 0;
	DEBUGFUNC("txgbe_set_mac_type");
	if (hw->vendor_id != PCI_VENDOR_ID_WANGXUN) {
		DEBUGOUT("Unsupported vendor id: %x", hw->vendor_id);
		return TXGBE_ERR_DEVICE_NOT_SUPPORTED;
	}
	switch (hw->device_id) {
	case TXGBE_DEV_ID_RAPTOR_KR_KX_KX4:
		hw->phy.media_type = txgbe_media_type_backplane;
		hw->mac.type = txgbe_mac_raptor;
		break;
	case TXGBE_DEV_ID_RAPTOR_XAUI:
	case TXGBE_DEV_ID_RAPTOR_SGMII:
		hw->phy.media_type = txgbe_media_type_copper;
		hw->mac.type = txgbe_mac_raptor;
		break;
	case TXGBE_DEV_ID_RAPTOR_SFP:
	case TXGBE_DEV_ID_WX1820_SFP:
		hw->phy.media_type = txgbe_media_type_fiber;
		hw->mac.type = txgbe_mac_raptor;
		break;
	case TXGBE_DEV_ID_RAPTOR_QSFP:
		hw->phy.media_type = txgbe_media_type_fiber_qsfp;
		hw->mac.type = txgbe_mac_raptor;
		break;
	case TXGBE_DEV_ID_RAPTOR_VF:
	case TXGBE_DEV_ID_RAPTOR_VF_HV:
		hw->phy.media_type = txgbe_media_type_virtual;
		hw->mac.type = txgbe_mac_raptor_vf;
		break;
	default:
		err = TXGBE_ERR_DEVICE_NOT_SUPPORTED;
		DEBUGOUT("Unsupported device id: %x", hw->device_id);
		break;
	}
	DEBUGOUT("found mac: %d media: %d, returns: %d\n",
		  hw->mac.type, hw->phy.media_type, err);
	return err;
}
s32 txgbe_set_mac_type ( struct txgbe_hw * hw ) { s32 err = 0 ; DEBUGFUNC ( " " ) ; if ( hw -> vendor_id != PCI_VENDOR_ID_WANGXUN ) { DEBUGOUT ( " " , hw -> vendor_id ) ; return TXGBE_ERR_DEVICE_NOT_SUPPORTED ; } switch ( hw -> device_id ) { case TXGBE_DEV_ID_RAPTOR_KR_KX_KX4 : hw -> phy . media_type = txgbe_media_type_backplane ; hw -> mac . type = txgbe_mac_raptor ; break ; case TXGBE_DEV_ID_RAPTOR_XAUI : case TXGBE_DEV_ID_RAPTOR_SGMII : hw -> phy . media_type = txgbe_media_type_copper ; hw -> mac . type = txgbe_mac_raptor ; break ; case TXGBE_DEV_ID_RAPTOR_SFP : case TXGBE_DEV_ID_WX1820_SFP : hw -> phy . media_type = txgbe_media_type_fiber ; hw -> mac . type = txgbe_mac_raptor ; break ; case TXGBE_DEV_ID_RAPTOR_QSFP : hw -> phy . media_type = txgbe_media_type_fiber_qsfp ; hw -> mac . type = txgbe_mac_raptor ; break ; case TXGBE_DEV_ID_RAPTOR_VF : case TXGBE_DEV_ID_RAPTOR_VF_HV : hw -> phy . media_type = txgbe_media_type_virtual ; hw -> mac . type = txgbe_mac_raptor_vf ; break ; default : err = TXGBE_ERR_DEVICE_NOT_SUPPORTED ; DEBUGOUT ( " " , hw -> device_id ) ; break ; } DEBUGOUT ( " \n " , hw -> mac . type , hw -> phy . media_type , err ) ; return err ; }
txgbe_set_mac_type - Sets MAC type
  @hw: pointer to the HW structure
txgbe_set_mac_type - Sets MAC type @hw : pointer to the HW structure