xref: /openbmc/linux/drivers/net/ethernet/intel/iavf/iavf_common.c (revision 86aa961bb4619a68077ebeba21c52e9ba0eab43d)
166bc8e0fSJesse Brandeburg // SPDX-License-Identifier: GPL-2.0
266bc8e0fSJesse Brandeburg /* Copyright(c) 2013 - 2018 Intel Corporation. */
366bc8e0fSJesse Brandeburg 
4*e383353bSJesse Brandeburg #include <linux/avf/virtchnl.h>
5*e383353bSJesse Brandeburg #include <linux/bitfield.h>
666bc8e0fSJesse Brandeburg #include "iavf_type.h"
78be454c9SAlice Michael #include "iavf_adminq.h"
866bc8e0fSJesse Brandeburg #include "iavf_prototype.h"
966bc8e0fSJesse Brandeburg 
1066bc8e0fSJesse Brandeburg /**
1166bc8e0fSJesse Brandeburg  * iavf_set_mac_type - Sets MAC type
1266bc8e0fSJesse Brandeburg  * @hw: pointer to the HW structure
1366bc8e0fSJesse Brandeburg  *
1466bc8e0fSJesse Brandeburg  * This function sets the mac type of the adapter based on the
1566bc8e0fSJesse Brandeburg  * vendor ID and device ID stored in the hw structure.
1666bc8e0fSJesse Brandeburg  **/
iavf_set_mac_type(struct iavf_hw * hw)1780754bbcSSergey Nemov enum iavf_status iavf_set_mac_type(struct iavf_hw *hw)
1866bc8e0fSJesse Brandeburg {
1980754bbcSSergey Nemov 	enum iavf_status status = 0;
2066bc8e0fSJesse Brandeburg 
2166bc8e0fSJesse Brandeburg 	if (hw->vendor_id == PCI_VENDOR_ID_INTEL) {
2266bc8e0fSJesse Brandeburg 		switch (hw->device_id) {
2366bc8e0fSJesse Brandeburg 		case IAVF_DEV_ID_X722_VF:
2466bc8e0fSJesse Brandeburg 			hw->mac.type = IAVF_MAC_X722_VF;
2566bc8e0fSJesse Brandeburg 			break;
2666bc8e0fSJesse Brandeburg 		case IAVF_DEV_ID_VF:
2766bc8e0fSJesse Brandeburg 		case IAVF_DEV_ID_VF_HV:
2866bc8e0fSJesse Brandeburg 		case IAVF_DEV_ID_ADAPTIVE_VF:
2966bc8e0fSJesse Brandeburg 			hw->mac.type = IAVF_MAC_VF;
3066bc8e0fSJesse Brandeburg 			break;
3166bc8e0fSJesse Brandeburg 		default:
3266bc8e0fSJesse Brandeburg 			hw->mac.type = IAVF_MAC_GENERIC;
3366bc8e0fSJesse Brandeburg 			break;
3466bc8e0fSJesse Brandeburg 		}
3566bc8e0fSJesse Brandeburg 	} else {
368821b3faSAlice Michael 		status = IAVF_ERR_DEVICE_NOT_SUPPORTED;
3766bc8e0fSJesse Brandeburg 	}
3866bc8e0fSJesse Brandeburg 
3966bc8e0fSJesse Brandeburg 	return status;
4066bc8e0fSJesse Brandeburg }
4166bc8e0fSJesse Brandeburg 
4266bc8e0fSJesse Brandeburg /**
4366bc8e0fSJesse Brandeburg  * iavf_aq_str - convert AQ err code to a string
4466bc8e0fSJesse Brandeburg  * @hw: pointer to the HW structure
4566bc8e0fSJesse Brandeburg  * @aq_err: the AQ error code to convert
4666bc8e0fSJesse Brandeburg  **/
iavf_aq_str(struct iavf_hw * hw,enum iavf_admin_queue_err aq_err)477af36e32SAlice Michael const char *iavf_aq_str(struct iavf_hw *hw, enum iavf_admin_queue_err aq_err)
4866bc8e0fSJesse Brandeburg {
4966bc8e0fSJesse Brandeburg 	switch (aq_err) {
507af36e32SAlice Michael 	case IAVF_AQ_RC_OK:
5166bc8e0fSJesse Brandeburg 		return "OK";
527af36e32SAlice Michael 	case IAVF_AQ_RC_EPERM:
537af36e32SAlice Michael 		return "IAVF_AQ_RC_EPERM";
547af36e32SAlice Michael 	case IAVF_AQ_RC_ENOENT:
557af36e32SAlice Michael 		return "IAVF_AQ_RC_ENOENT";
567af36e32SAlice Michael 	case IAVF_AQ_RC_ESRCH:
577af36e32SAlice Michael 		return "IAVF_AQ_RC_ESRCH";
587af36e32SAlice Michael 	case IAVF_AQ_RC_EINTR:
597af36e32SAlice Michael 		return "IAVF_AQ_RC_EINTR";
607af36e32SAlice Michael 	case IAVF_AQ_RC_EIO:
617af36e32SAlice Michael 		return "IAVF_AQ_RC_EIO";
627af36e32SAlice Michael 	case IAVF_AQ_RC_ENXIO:
637af36e32SAlice Michael 		return "IAVF_AQ_RC_ENXIO";
647af36e32SAlice Michael 	case IAVF_AQ_RC_E2BIG:
657af36e32SAlice Michael 		return "IAVF_AQ_RC_E2BIG";
667af36e32SAlice Michael 	case IAVF_AQ_RC_EAGAIN:
677af36e32SAlice Michael 		return "IAVF_AQ_RC_EAGAIN";
687af36e32SAlice Michael 	case IAVF_AQ_RC_ENOMEM:
697af36e32SAlice Michael 		return "IAVF_AQ_RC_ENOMEM";
707af36e32SAlice Michael 	case IAVF_AQ_RC_EACCES:
717af36e32SAlice Michael 		return "IAVF_AQ_RC_EACCES";
727af36e32SAlice Michael 	case IAVF_AQ_RC_EFAULT:
737af36e32SAlice Michael 		return "IAVF_AQ_RC_EFAULT";
747af36e32SAlice Michael 	case IAVF_AQ_RC_EBUSY:
757af36e32SAlice Michael 		return "IAVF_AQ_RC_EBUSY";
767af36e32SAlice Michael 	case IAVF_AQ_RC_EEXIST:
777af36e32SAlice Michael 		return "IAVF_AQ_RC_EEXIST";
787af36e32SAlice Michael 	case IAVF_AQ_RC_EINVAL:
797af36e32SAlice Michael 		return "IAVF_AQ_RC_EINVAL";
807af36e32SAlice Michael 	case IAVF_AQ_RC_ENOTTY:
817af36e32SAlice Michael 		return "IAVF_AQ_RC_ENOTTY";
827af36e32SAlice Michael 	case IAVF_AQ_RC_ENOSPC:
837af36e32SAlice Michael 		return "IAVF_AQ_RC_ENOSPC";
847af36e32SAlice Michael 	case IAVF_AQ_RC_ENOSYS:
857af36e32SAlice Michael 		return "IAVF_AQ_RC_ENOSYS";
867af36e32SAlice Michael 	case IAVF_AQ_RC_ERANGE:
877af36e32SAlice Michael 		return "IAVF_AQ_RC_ERANGE";
887af36e32SAlice Michael 	case IAVF_AQ_RC_EFLUSHED:
897af36e32SAlice Michael 		return "IAVF_AQ_RC_EFLUSHED";
907af36e32SAlice Michael 	case IAVF_AQ_RC_BAD_ADDR:
917af36e32SAlice Michael 		return "IAVF_AQ_RC_BAD_ADDR";
927af36e32SAlice Michael 	case IAVF_AQ_RC_EMODE:
937af36e32SAlice Michael 		return "IAVF_AQ_RC_EMODE";
947af36e32SAlice Michael 	case IAVF_AQ_RC_EFBIG:
957af36e32SAlice Michael 		return "IAVF_AQ_RC_EFBIG";
9666bc8e0fSJesse Brandeburg 	}
9766bc8e0fSJesse Brandeburg 
9866bc8e0fSJesse Brandeburg 	snprintf(hw->err_str, sizeof(hw->err_str), "%d", aq_err);
9966bc8e0fSJesse Brandeburg 	return hw->err_str;
10066bc8e0fSJesse Brandeburg }
10166bc8e0fSJesse Brandeburg 
10266bc8e0fSJesse Brandeburg /**
10366bc8e0fSJesse Brandeburg  * iavf_stat_str - convert status err code to a string
10466bc8e0fSJesse Brandeburg  * @hw: pointer to the HW structure
10566bc8e0fSJesse Brandeburg  * @stat_err: the status error code to convert
10666bc8e0fSJesse Brandeburg  **/
iavf_stat_str(struct iavf_hw * hw,enum iavf_status stat_err)10780754bbcSSergey Nemov const char *iavf_stat_str(struct iavf_hw *hw, enum iavf_status stat_err)
10866bc8e0fSJesse Brandeburg {
10966bc8e0fSJesse Brandeburg 	switch (stat_err) {
11066bc8e0fSJesse Brandeburg 	case 0:
11166bc8e0fSJesse Brandeburg 		return "OK";
1128821b3faSAlice Michael 	case IAVF_ERR_NVM:
1138821b3faSAlice Michael 		return "IAVF_ERR_NVM";
1148821b3faSAlice Michael 	case IAVF_ERR_NVM_CHECKSUM:
1158821b3faSAlice Michael 		return "IAVF_ERR_NVM_CHECKSUM";
1168821b3faSAlice Michael 	case IAVF_ERR_PHY:
1178821b3faSAlice Michael 		return "IAVF_ERR_PHY";
1188821b3faSAlice Michael 	case IAVF_ERR_CONFIG:
1198821b3faSAlice Michael 		return "IAVF_ERR_CONFIG";
1208821b3faSAlice Michael 	case IAVF_ERR_PARAM:
1218821b3faSAlice Michael 		return "IAVF_ERR_PARAM";
1228821b3faSAlice Michael 	case IAVF_ERR_MAC_TYPE:
1238821b3faSAlice Michael 		return "IAVF_ERR_MAC_TYPE";
1248821b3faSAlice Michael 	case IAVF_ERR_UNKNOWN_PHY:
1258821b3faSAlice Michael 		return "IAVF_ERR_UNKNOWN_PHY";
1268821b3faSAlice Michael 	case IAVF_ERR_LINK_SETUP:
1278821b3faSAlice Michael 		return "IAVF_ERR_LINK_SETUP";
1288821b3faSAlice Michael 	case IAVF_ERR_ADAPTER_STOPPED:
1298821b3faSAlice Michael 		return "IAVF_ERR_ADAPTER_STOPPED";
1308821b3faSAlice Michael 	case IAVF_ERR_INVALID_MAC_ADDR:
1318821b3faSAlice Michael 		return "IAVF_ERR_INVALID_MAC_ADDR";
1328821b3faSAlice Michael 	case IAVF_ERR_DEVICE_NOT_SUPPORTED:
1338821b3faSAlice Michael 		return "IAVF_ERR_DEVICE_NOT_SUPPORTED";
1340a62b209SMateusz Palczewski 	case IAVF_ERR_PRIMARY_REQUESTS_PENDING:
1350a62b209SMateusz Palczewski 		return "IAVF_ERR_PRIMARY_REQUESTS_PENDING";
1368821b3faSAlice Michael 	case IAVF_ERR_INVALID_LINK_SETTINGS:
1378821b3faSAlice Michael 		return "IAVF_ERR_INVALID_LINK_SETTINGS";
1388821b3faSAlice Michael 	case IAVF_ERR_AUTONEG_NOT_COMPLETE:
1398821b3faSAlice Michael 		return "IAVF_ERR_AUTONEG_NOT_COMPLETE";
1408821b3faSAlice Michael 	case IAVF_ERR_RESET_FAILED:
1418821b3faSAlice Michael 		return "IAVF_ERR_RESET_FAILED";
1428821b3faSAlice Michael 	case IAVF_ERR_SWFW_SYNC:
1438821b3faSAlice Michael 		return "IAVF_ERR_SWFW_SYNC";
1448821b3faSAlice Michael 	case IAVF_ERR_NO_AVAILABLE_VSI:
1458821b3faSAlice Michael 		return "IAVF_ERR_NO_AVAILABLE_VSI";
1468821b3faSAlice Michael 	case IAVF_ERR_NO_MEMORY:
1478821b3faSAlice Michael 		return "IAVF_ERR_NO_MEMORY";
1488821b3faSAlice Michael 	case IAVF_ERR_BAD_PTR:
1498821b3faSAlice Michael 		return "IAVF_ERR_BAD_PTR";
1508821b3faSAlice Michael 	case IAVF_ERR_RING_FULL:
1518821b3faSAlice Michael 		return "IAVF_ERR_RING_FULL";
1528821b3faSAlice Michael 	case IAVF_ERR_INVALID_PD_ID:
1538821b3faSAlice Michael 		return "IAVF_ERR_INVALID_PD_ID";
1548821b3faSAlice Michael 	case IAVF_ERR_INVALID_QP_ID:
1558821b3faSAlice Michael 		return "IAVF_ERR_INVALID_QP_ID";
1568821b3faSAlice Michael 	case IAVF_ERR_INVALID_CQ_ID:
1578821b3faSAlice Michael 		return "IAVF_ERR_INVALID_CQ_ID";
1588821b3faSAlice Michael 	case IAVF_ERR_INVALID_CEQ_ID:
1598821b3faSAlice Michael 		return "IAVF_ERR_INVALID_CEQ_ID";
1608821b3faSAlice Michael 	case IAVF_ERR_INVALID_AEQ_ID:
1618821b3faSAlice Michael 		return "IAVF_ERR_INVALID_AEQ_ID";
1628821b3faSAlice Michael 	case IAVF_ERR_INVALID_SIZE:
1638821b3faSAlice Michael 		return "IAVF_ERR_INVALID_SIZE";
1648821b3faSAlice Michael 	case IAVF_ERR_INVALID_ARP_INDEX:
1658821b3faSAlice Michael 		return "IAVF_ERR_INVALID_ARP_INDEX";
1668821b3faSAlice Michael 	case IAVF_ERR_INVALID_FPM_FUNC_ID:
1678821b3faSAlice Michael 		return "IAVF_ERR_INVALID_FPM_FUNC_ID";
1688821b3faSAlice Michael 	case IAVF_ERR_QP_INVALID_MSG_SIZE:
1698821b3faSAlice Michael 		return "IAVF_ERR_QP_INVALID_MSG_SIZE";
1708821b3faSAlice Michael 	case IAVF_ERR_QP_TOOMANY_WRS_POSTED:
1718821b3faSAlice Michael 		return "IAVF_ERR_QP_TOOMANY_WRS_POSTED";
1728821b3faSAlice Michael 	case IAVF_ERR_INVALID_FRAG_COUNT:
1738821b3faSAlice Michael 		return "IAVF_ERR_INVALID_FRAG_COUNT";
1748821b3faSAlice Michael 	case IAVF_ERR_QUEUE_EMPTY:
1758821b3faSAlice Michael 		return "IAVF_ERR_QUEUE_EMPTY";
1768821b3faSAlice Michael 	case IAVF_ERR_INVALID_ALIGNMENT:
1778821b3faSAlice Michael 		return "IAVF_ERR_INVALID_ALIGNMENT";
1788821b3faSAlice Michael 	case IAVF_ERR_FLUSHED_QUEUE:
1798821b3faSAlice Michael 		return "IAVF_ERR_FLUSHED_QUEUE";
1808821b3faSAlice Michael 	case IAVF_ERR_INVALID_PUSH_PAGE_INDEX:
1818821b3faSAlice Michael 		return "IAVF_ERR_INVALID_PUSH_PAGE_INDEX";
1828821b3faSAlice Michael 	case IAVF_ERR_INVALID_IMM_DATA_SIZE:
1838821b3faSAlice Michael 		return "IAVF_ERR_INVALID_IMM_DATA_SIZE";
1848821b3faSAlice Michael 	case IAVF_ERR_TIMEOUT:
1858821b3faSAlice Michael 		return "IAVF_ERR_TIMEOUT";
1868821b3faSAlice Michael 	case IAVF_ERR_OPCODE_MISMATCH:
1878821b3faSAlice Michael 		return "IAVF_ERR_OPCODE_MISMATCH";
1888821b3faSAlice Michael 	case IAVF_ERR_CQP_COMPL_ERROR:
1898821b3faSAlice Michael 		return "IAVF_ERR_CQP_COMPL_ERROR";
1908821b3faSAlice Michael 	case IAVF_ERR_INVALID_VF_ID:
1918821b3faSAlice Michael 		return "IAVF_ERR_INVALID_VF_ID";
1928821b3faSAlice Michael 	case IAVF_ERR_INVALID_HMCFN_ID:
1938821b3faSAlice Michael 		return "IAVF_ERR_INVALID_HMCFN_ID";
1948821b3faSAlice Michael 	case IAVF_ERR_BACKING_PAGE_ERROR:
1958821b3faSAlice Michael 		return "IAVF_ERR_BACKING_PAGE_ERROR";
1968821b3faSAlice Michael 	case IAVF_ERR_NO_PBLCHUNKS_AVAILABLE:
1978821b3faSAlice Michael 		return "IAVF_ERR_NO_PBLCHUNKS_AVAILABLE";
1988821b3faSAlice Michael 	case IAVF_ERR_INVALID_PBLE_INDEX:
1998821b3faSAlice Michael 		return "IAVF_ERR_INVALID_PBLE_INDEX";
2008821b3faSAlice Michael 	case IAVF_ERR_INVALID_SD_INDEX:
2018821b3faSAlice Michael 		return "IAVF_ERR_INVALID_SD_INDEX";
2028821b3faSAlice Michael 	case IAVF_ERR_INVALID_PAGE_DESC_INDEX:
2038821b3faSAlice Michael 		return "IAVF_ERR_INVALID_PAGE_DESC_INDEX";
2048821b3faSAlice Michael 	case IAVF_ERR_INVALID_SD_TYPE:
2058821b3faSAlice Michael 		return "IAVF_ERR_INVALID_SD_TYPE";
2068821b3faSAlice Michael 	case IAVF_ERR_MEMCPY_FAILED:
2078821b3faSAlice Michael 		return "IAVF_ERR_MEMCPY_FAILED";
2088821b3faSAlice Michael 	case IAVF_ERR_INVALID_HMC_OBJ_INDEX:
2098821b3faSAlice Michael 		return "IAVF_ERR_INVALID_HMC_OBJ_INDEX";
2108821b3faSAlice Michael 	case IAVF_ERR_INVALID_HMC_OBJ_COUNT:
2118821b3faSAlice Michael 		return "IAVF_ERR_INVALID_HMC_OBJ_COUNT";
2128821b3faSAlice Michael 	case IAVF_ERR_INVALID_SRQ_ARM_LIMIT:
2138821b3faSAlice Michael 		return "IAVF_ERR_INVALID_SRQ_ARM_LIMIT";
2148821b3faSAlice Michael 	case IAVF_ERR_SRQ_ENABLED:
2158821b3faSAlice Michael 		return "IAVF_ERR_SRQ_ENABLED";
2168821b3faSAlice Michael 	case IAVF_ERR_ADMIN_QUEUE_ERROR:
2178821b3faSAlice Michael 		return "IAVF_ERR_ADMIN_QUEUE_ERROR";
2188821b3faSAlice Michael 	case IAVF_ERR_ADMIN_QUEUE_TIMEOUT:
2198821b3faSAlice Michael 		return "IAVF_ERR_ADMIN_QUEUE_TIMEOUT";
2208821b3faSAlice Michael 	case IAVF_ERR_BUF_TOO_SHORT:
2218821b3faSAlice Michael 		return "IAVF_ERR_BUF_TOO_SHORT";
2228821b3faSAlice Michael 	case IAVF_ERR_ADMIN_QUEUE_FULL:
2238821b3faSAlice Michael 		return "IAVF_ERR_ADMIN_QUEUE_FULL";
2248821b3faSAlice Michael 	case IAVF_ERR_ADMIN_QUEUE_NO_WORK:
2258821b3faSAlice Michael 		return "IAVF_ERR_ADMIN_QUEUE_NO_WORK";
2262723f3b5SJesse Brandeburg 	case IAVF_ERR_BAD_RDMA_CQE:
2272723f3b5SJesse Brandeburg 		return "IAVF_ERR_BAD_RDMA_CQE";
2288821b3faSAlice Michael 	case IAVF_ERR_NVM_BLANK_MODE:
2298821b3faSAlice Michael 		return "IAVF_ERR_NVM_BLANK_MODE";
2308821b3faSAlice Michael 	case IAVF_ERR_NOT_IMPLEMENTED:
2318821b3faSAlice Michael 		return "IAVF_ERR_NOT_IMPLEMENTED";
2328821b3faSAlice Michael 	case IAVF_ERR_PE_DOORBELL_NOT_ENABLED:
2338821b3faSAlice Michael 		return "IAVF_ERR_PE_DOORBELL_NOT_ENABLED";
2348821b3faSAlice Michael 	case IAVF_ERR_DIAG_TEST_FAILED:
2358821b3faSAlice Michael 		return "IAVF_ERR_DIAG_TEST_FAILED";
2368821b3faSAlice Michael 	case IAVF_ERR_NOT_READY:
2378821b3faSAlice Michael 		return "IAVF_ERR_NOT_READY";
2388821b3faSAlice Michael 	case IAVF_NOT_SUPPORTED:
2398821b3faSAlice Michael 		return "IAVF_NOT_SUPPORTED";
2408821b3faSAlice Michael 	case IAVF_ERR_FIRMWARE_API_VERSION:
2418821b3faSAlice Michael 		return "IAVF_ERR_FIRMWARE_API_VERSION";
2428821b3faSAlice Michael 	case IAVF_ERR_ADMIN_QUEUE_CRITICAL_ERROR:
2438821b3faSAlice Michael 		return "IAVF_ERR_ADMIN_QUEUE_CRITICAL_ERROR";
24466bc8e0fSJesse Brandeburg 	}
24566bc8e0fSJesse Brandeburg 
24666bc8e0fSJesse Brandeburg 	snprintf(hw->err_str, sizeof(hw->err_str), "%d", stat_err);
24766bc8e0fSJesse Brandeburg 	return hw->err_str;
24866bc8e0fSJesse Brandeburg }
24966bc8e0fSJesse Brandeburg 
25066bc8e0fSJesse Brandeburg /**
25166bc8e0fSJesse Brandeburg  * iavf_debug_aq
25266bc8e0fSJesse Brandeburg  * @hw: debug mask related to admin queue
25366bc8e0fSJesse Brandeburg  * @mask: debug mask
25466bc8e0fSJesse Brandeburg  * @desc: pointer to admin queue descriptor
25566bc8e0fSJesse Brandeburg  * @buffer: pointer to command buffer
25666bc8e0fSJesse Brandeburg  * @buf_len: max length of buffer
25766bc8e0fSJesse Brandeburg  *
25866bc8e0fSJesse Brandeburg  * Dumps debug log about adminq command with descriptor contents.
25966bc8e0fSJesse Brandeburg  **/
iavf_debug_aq(struct iavf_hw * hw,enum iavf_debug_mask mask,void * desc,void * buffer,u16 buf_len)26066bc8e0fSJesse Brandeburg void iavf_debug_aq(struct iavf_hw *hw, enum iavf_debug_mask mask, void *desc,
26166bc8e0fSJesse Brandeburg 		   void *buffer, u16 buf_len)
26266bc8e0fSJesse Brandeburg {
2637af36e32SAlice Michael 	struct iavf_aq_desc *aq_desc = (struct iavf_aq_desc *)desc;
26466bc8e0fSJesse Brandeburg 	u8 *buf = (u8 *)buffer;
26566bc8e0fSJesse Brandeburg 
26666bc8e0fSJesse Brandeburg 	if ((!(mask & hw->debug_mask)) || !desc)
26766bc8e0fSJesse Brandeburg 		return;
26866bc8e0fSJesse Brandeburg 
26966bc8e0fSJesse Brandeburg 	iavf_debug(hw, mask,
27066bc8e0fSJesse Brandeburg 		   "AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
27166bc8e0fSJesse Brandeburg 		   le16_to_cpu(aq_desc->opcode),
27266bc8e0fSJesse Brandeburg 		   le16_to_cpu(aq_desc->flags),
27366bc8e0fSJesse Brandeburg 		   le16_to_cpu(aq_desc->datalen),
27466bc8e0fSJesse Brandeburg 		   le16_to_cpu(aq_desc->retval));
27566bc8e0fSJesse Brandeburg 	iavf_debug(hw, mask, "\tcookie (h,l) 0x%08X 0x%08X\n",
27666bc8e0fSJesse Brandeburg 		   le32_to_cpu(aq_desc->cookie_high),
27766bc8e0fSJesse Brandeburg 		   le32_to_cpu(aq_desc->cookie_low));
27866bc8e0fSJesse Brandeburg 	iavf_debug(hw, mask, "\tparam (0,1)  0x%08X 0x%08X\n",
27966bc8e0fSJesse Brandeburg 		   le32_to_cpu(aq_desc->params.internal.param0),
28066bc8e0fSJesse Brandeburg 		   le32_to_cpu(aq_desc->params.internal.param1));
28166bc8e0fSJesse Brandeburg 	iavf_debug(hw, mask, "\taddr (h,l)   0x%08X 0x%08X\n",
28266bc8e0fSJesse Brandeburg 		   le32_to_cpu(aq_desc->params.external.addr_high),
28366bc8e0fSJesse Brandeburg 		   le32_to_cpu(aq_desc->params.external.addr_low));
28466bc8e0fSJesse Brandeburg 
28566bc8e0fSJesse Brandeburg 	if (buffer && aq_desc->datalen) {
28666bc8e0fSJesse Brandeburg 		u16 len = le16_to_cpu(aq_desc->datalen);
28766bc8e0fSJesse Brandeburg 
28866bc8e0fSJesse Brandeburg 		iavf_debug(hw, mask, "AQ CMD Buffer:\n");
28966bc8e0fSJesse Brandeburg 		if (buf_len < len)
29066bc8e0fSJesse Brandeburg 			len = buf_len;
29166bc8e0fSJesse Brandeburg 		/* write the full 16-byte chunks */
29266bc8e0fSJesse Brandeburg 		if (hw->debug_mask & mask) {
29366bc8e0fSJesse Brandeburg 			char prefix[27];
29466bc8e0fSJesse Brandeburg 
29566bc8e0fSJesse Brandeburg 			snprintf(prefix, sizeof(prefix),
29666bc8e0fSJesse Brandeburg 				 "iavf %02x:%02x.%x: \t0x",
29766bc8e0fSJesse Brandeburg 				 hw->bus.bus_id,
29866bc8e0fSJesse Brandeburg 				 hw->bus.device,
29966bc8e0fSJesse Brandeburg 				 hw->bus.func);
30066bc8e0fSJesse Brandeburg 
30166bc8e0fSJesse Brandeburg 			print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET,
30266bc8e0fSJesse Brandeburg 				       16, 1, buf, len, false);
30366bc8e0fSJesse Brandeburg 		}
30466bc8e0fSJesse Brandeburg 	}
30566bc8e0fSJesse Brandeburg }
30666bc8e0fSJesse Brandeburg 
30766bc8e0fSJesse Brandeburg /**
30866bc8e0fSJesse Brandeburg  * iavf_check_asq_alive
30966bc8e0fSJesse Brandeburg  * @hw: pointer to the hw struct
31066bc8e0fSJesse Brandeburg  *
31166bc8e0fSJesse Brandeburg  * Returns true if Queue is enabled else false.
31266bc8e0fSJesse Brandeburg  **/
iavf_check_asq_alive(struct iavf_hw * hw)31366bc8e0fSJesse Brandeburg bool iavf_check_asq_alive(struct iavf_hw *hw)
31466bc8e0fSJesse Brandeburg {
31566bc8e0fSJesse Brandeburg 	if (hw->aq.asq.len)
31666bc8e0fSJesse Brandeburg 		return !!(rd32(hw, hw->aq.asq.len) &
31766bc8e0fSJesse Brandeburg 			  IAVF_VF_ATQLEN1_ATQENABLE_MASK);
31866bc8e0fSJesse Brandeburg 	else
31966bc8e0fSJesse Brandeburg 		return false;
32066bc8e0fSJesse Brandeburg }
32166bc8e0fSJesse Brandeburg 
32266bc8e0fSJesse Brandeburg /**
32366bc8e0fSJesse Brandeburg  * iavf_aq_queue_shutdown
32466bc8e0fSJesse Brandeburg  * @hw: pointer to the hw struct
32566bc8e0fSJesse Brandeburg  * @unloading: is the driver unloading itself
32666bc8e0fSJesse Brandeburg  *
32766bc8e0fSJesse Brandeburg  * Tell the Firmware that we're shutting down the AdminQ and whether
32866bc8e0fSJesse Brandeburg  * or not the driver is unloading as well.
32966bc8e0fSJesse Brandeburg  **/
iavf_aq_queue_shutdown(struct iavf_hw * hw,bool unloading)33080754bbcSSergey Nemov enum iavf_status iavf_aq_queue_shutdown(struct iavf_hw *hw, bool unloading)
33166bc8e0fSJesse Brandeburg {
3327af36e32SAlice Michael 	struct iavf_aq_desc desc;
3337af36e32SAlice Michael 	struct iavf_aqc_queue_shutdown *cmd =
3347af36e32SAlice Michael 		(struct iavf_aqc_queue_shutdown *)&desc.params.raw;
33580754bbcSSergey Nemov 	enum iavf_status status;
33666bc8e0fSJesse Brandeburg 
3377af36e32SAlice Michael 	iavf_fill_default_direct_cmd_desc(&desc, iavf_aqc_opc_queue_shutdown);
33866bc8e0fSJesse Brandeburg 
33966bc8e0fSJesse Brandeburg 	if (unloading)
3407af36e32SAlice Michael 		cmd->driver_unloading = cpu_to_le32(IAVF_AQ_DRIVER_UNLOADING);
34166bc8e0fSJesse Brandeburg 	status = iavf_asq_send_command(hw, &desc, NULL, 0, NULL);
34266bc8e0fSJesse Brandeburg 
34366bc8e0fSJesse Brandeburg 	return status;
34466bc8e0fSJesse Brandeburg }
34566bc8e0fSJesse Brandeburg 
34666bc8e0fSJesse Brandeburg /**
34766bc8e0fSJesse Brandeburg  * iavf_aq_get_set_rss_lut
34866bc8e0fSJesse Brandeburg  * @hw: pointer to the hardware structure
34966bc8e0fSJesse Brandeburg  * @vsi_id: vsi fw index
35066bc8e0fSJesse Brandeburg  * @pf_lut: for PF table set true, for VSI table set false
35166bc8e0fSJesse Brandeburg  * @lut: pointer to the lut buffer provided by the caller
35266bc8e0fSJesse Brandeburg  * @lut_size: size of the lut buffer
35366bc8e0fSJesse Brandeburg  * @set: set true to set the table, false to get the table
35466bc8e0fSJesse Brandeburg  *
35566bc8e0fSJesse Brandeburg  * Internal function to get or set RSS look up table
35666bc8e0fSJesse Brandeburg  **/
iavf_aq_get_set_rss_lut(struct iavf_hw * hw,u16 vsi_id,bool pf_lut,u8 * lut,u16 lut_size,bool set)35780754bbcSSergey Nemov static enum iavf_status iavf_aq_get_set_rss_lut(struct iavf_hw *hw,
35866bc8e0fSJesse Brandeburg 						u16 vsi_id, bool pf_lut,
35966bc8e0fSJesse Brandeburg 						u8 *lut, u16 lut_size,
36066bc8e0fSJesse Brandeburg 						bool set)
36166bc8e0fSJesse Brandeburg {
36280754bbcSSergey Nemov 	enum iavf_status status;
3637af36e32SAlice Michael 	struct iavf_aq_desc desc;
3647af36e32SAlice Michael 	struct iavf_aqc_get_set_rss_lut *cmd_resp =
3657af36e32SAlice Michael 		   (struct iavf_aqc_get_set_rss_lut *)&desc.params.raw;
36666bc8e0fSJesse Brandeburg 
36766bc8e0fSJesse Brandeburg 	if (set)
36866bc8e0fSJesse Brandeburg 		iavf_fill_default_direct_cmd_desc(&desc,
3697af36e32SAlice Michael 						  iavf_aqc_opc_set_rss_lut);
37066bc8e0fSJesse Brandeburg 	else
37166bc8e0fSJesse Brandeburg 		iavf_fill_default_direct_cmd_desc(&desc,
3727af36e32SAlice Michael 						  iavf_aqc_opc_get_rss_lut);
37366bc8e0fSJesse Brandeburg 
37466bc8e0fSJesse Brandeburg 	/* Indirect command */
3757af36e32SAlice Michael 	desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_BUF);
3767af36e32SAlice Michael 	desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_RD);
37766bc8e0fSJesse Brandeburg 
37866bc8e0fSJesse Brandeburg 	cmd_resp->vsi_id =
37966bc8e0fSJesse Brandeburg 			cpu_to_le16((u16)((vsi_id <<
3807af36e32SAlice Michael 					  IAVF_AQC_SET_RSS_LUT_VSI_ID_SHIFT) &
3817af36e32SAlice Michael 					  IAVF_AQC_SET_RSS_LUT_VSI_ID_MASK));
3827af36e32SAlice Michael 	cmd_resp->vsi_id |= cpu_to_le16((u16)IAVF_AQC_SET_RSS_LUT_VSI_VALID);
38366bc8e0fSJesse Brandeburg 
38466bc8e0fSJesse Brandeburg 	if (pf_lut)
38566bc8e0fSJesse Brandeburg 		cmd_resp->flags |= cpu_to_le16((u16)
3867af36e32SAlice Michael 					((IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_PF <<
3877af36e32SAlice Michael 					IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT) &
3887af36e32SAlice Michael 					IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_MASK));
38966bc8e0fSJesse Brandeburg 	else
39066bc8e0fSJesse Brandeburg 		cmd_resp->flags |= cpu_to_le16((u16)
3917af36e32SAlice Michael 					((IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_VSI <<
3927af36e32SAlice Michael 					IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_SHIFT) &
3937af36e32SAlice Michael 					IAVF_AQC_SET_RSS_LUT_TABLE_TYPE_MASK));
39466bc8e0fSJesse Brandeburg 
39566bc8e0fSJesse Brandeburg 	status = iavf_asq_send_command(hw, &desc, lut, lut_size, NULL);
39666bc8e0fSJesse Brandeburg 
39766bc8e0fSJesse Brandeburg 	return status;
39866bc8e0fSJesse Brandeburg }
39966bc8e0fSJesse Brandeburg 
40066bc8e0fSJesse Brandeburg /**
40166bc8e0fSJesse Brandeburg  * iavf_aq_set_rss_lut
40266bc8e0fSJesse Brandeburg  * @hw: pointer to the hardware structure
40366bc8e0fSJesse Brandeburg  * @vsi_id: vsi fw index
40466bc8e0fSJesse Brandeburg  * @pf_lut: for PF table set true, for VSI table set false
40566bc8e0fSJesse Brandeburg  * @lut: pointer to the lut buffer provided by the caller
40666bc8e0fSJesse Brandeburg  * @lut_size: size of the lut buffer
40766bc8e0fSJesse Brandeburg  *
40866bc8e0fSJesse Brandeburg  * set the RSS lookup table, PF or VSI type
40966bc8e0fSJesse Brandeburg  **/
iavf_aq_set_rss_lut(struct iavf_hw * hw,u16 vsi_id,bool pf_lut,u8 * lut,u16 lut_size)41080754bbcSSergey Nemov enum iavf_status iavf_aq_set_rss_lut(struct iavf_hw *hw, u16 vsi_id,
41166bc8e0fSJesse Brandeburg 				     bool pf_lut, u8 *lut, u16 lut_size)
41266bc8e0fSJesse Brandeburg {
41366bc8e0fSJesse Brandeburg 	return iavf_aq_get_set_rss_lut(hw, vsi_id, pf_lut, lut, lut_size, true);
41466bc8e0fSJesse Brandeburg }
41566bc8e0fSJesse Brandeburg 
41666bc8e0fSJesse Brandeburg /**
41766bc8e0fSJesse Brandeburg  * iavf_aq_get_set_rss_key
41866bc8e0fSJesse Brandeburg  * @hw: pointer to the hw struct
41966bc8e0fSJesse Brandeburg  * @vsi_id: vsi fw index
42066bc8e0fSJesse Brandeburg  * @key: pointer to key info struct
42166bc8e0fSJesse Brandeburg  * @set: set true to set the key, false to get the key
42266bc8e0fSJesse Brandeburg  *
42366bc8e0fSJesse Brandeburg  * get the RSS key per VSI
42466bc8e0fSJesse Brandeburg  **/
42580754bbcSSergey Nemov static enum
iavf_aq_get_set_rss_key(struct iavf_hw * hw,u16 vsi_id,struct iavf_aqc_get_set_rss_key_data * key,bool set)42666bc8e0fSJesse Brandeburg iavf_status iavf_aq_get_set_rss_key(struct iavf_hw *hw, u16 vsi_id,
4277af36e32SAlice Michael 				    struct iavf_aqc_get_set_rss_key_data *key,
42866bc8e0fSJesse Brandeburg 				    bool set)
42966bc8e0fSJesse Brandeburg {
43080754bbcSSergey Nemov 	enum iavf_status status;
4317af36e32SAlice Michael 	struct iavf_aq_desc desc;
4327af36e32SAlice Michael 	struct iavf_aqc_get_set_rss_key *cmd_resp =
4337af36e32SAlice Michael 			(struct iavf_aqc_get_set_rss_key *)&desc.params.raw;
4347af36e32SAlice Michael 	u16 key_size = sizeof(struct iavf_aqc_get_set_rss_key_data);
43566bc8e0fSJesse Brandeburg 
43666bc8e0fSJesse Brandeburg 	if (set)
43766bc8e0fSJesse Brandeburg 		iavf_fill_default_direct_cmd_desc(&desc,
4387af36e32SAlice Michael 						  iavf_aqc_opc_set_rss_key);
43966bc8e0fSJesse Brandeburg 	else
44066bc8e0fSJesse Brandeburg 		iavf_fill_default_direct_cmd_desc(&desc,
4417af36e32SAlice Michael 						  iavf_aqc_opc_get_rss_key);
44266bc8e0fSJesse Brandeburg 
44366bc8e0fSJesse Brandeburg 	/* Indirect command */
4447af36e32SAlice Michael 	desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_BUF);
4457af36e32SAlice Michael 	desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_RD);
44666bc8e0fSJesse Brandeburg 
44766bc8e0fSJesse Brandeburg 	cmd_resp->vsi_id =
44866bc8e0fSJesse Brandeburg 			cpu_to_le16((u16)((vsi_id <<
4497af36e32SAlice Michael 					  IAVF_AQC_SET_RSS_KEY_VSI_ID_SHIFT) &
4507af36e32SAlice Michael 					  IAVF_AQC_SET_RSS_KEY_VSI_ID_MASK));
4517af36e32SAlice Michael 	cmd_resp->vsi_id |= cpu_to_le16((u16)IAVF_AQC_SET_RSS_KEY_VSI_VALID);
45266bc8e0fSJesse Brandeburg 
45366bc8e0fSJesse Brandeburg 	status = iavf_asq_send_command(hw, &desc, key, key_size, NULL);
45466bc8e0fSJesse Brandeburg 
45566bc8e0fSJesse Brandeburg 	return status;
45666bc8e0fSJesse Brandeburg }
45766bc8e0fSJesse Brandeburg 
45866bc8e0fSJesse Brandeburg /**
45966bc8e0fSJesse Brandeburg  * iavf_aq_set_rss_key
46066bc8e0fSJesse Brandeburg  * @hw: pointer to the hw struct
46166bc8e0fSJesse Brandeburg  * @vsi_id: vsi fw index
46266bc8e0fSJesse Brandeburg  * @key: pointer to key info struct
46366bc8e0fSJesse Brandeburg  *
46466bc8e0fSJesse Brandeburg  * set the RSS key per VSI
46566bc8e0fSJesse Brandeburg  **/
iavf_aq_set_rss_key(struct iavf_hw * hw,u16 vsi_id,struct iavf_aqc_get_set_rss_key_data * key)46680754bbcSSergey Nemov enum iavf_status iavf_aq_set_rss_key(struct iavf_hw *hw, u16 vsi_id,
4677af36e32SAlice Michael 				     struct iavf_aqc_get_set_rss_key_data *key)
46866bc8e0fSJesse Brandeburg {
46966bc8e0fSJesse Brandeburg 	return iavf_aq_get_set_rss_key(hw, vsi_id, key, true);
47066bc8e0fSJesse Brandeburg }
47166bc8e0fSJesse Brandeburg 
47266bc8e0fSJesse Brandeburg /* The iavf_ptype_lookup table is used to convert from the 8-bit ptype in the
47366bc8e0fSJesse Brandeburg  * hardware to a bit-field that can be used by SW to more easily determine the
47466bc8e0fSJesse Brandeburg  * packet type.
47566bc8e0fSJesse Brandeburg  *
47666bc8e0fSJesse Brandeburg  * Macros are used to shorten the table lines and make this table human
47766bc8e0fSJesse Brandeburg  * readable.
47866bc8e0fSJesse Brandeburg  *
47966bc8e0fSJesse Brandeburg  * We store the PTYPE in the top byte of the bit field - this is just so that
48066bc8e0fSJesse Brandeburg  * we can check that the table doesn't have a row missing, as the index into
48166bc8e0fSJesse Brandeburg  * the table should be the PTYPE.
48266bc8e0fSJesse Brandeburg  *
48366bc8e0fSJesse Brandeburg  * Typical work flow:
48466bc8e0fSJesse Brandeburg  *
48566bc8e0fSJesse Brandeburg  * IF NOT iavf_ptype_lookup[ptype].known
48666bc8e0fSJesse Brandeburg  * THEN
48766bc8e0fSJesse Brandeburg  *      Packet is unknown
488fdad1d54SAlice Michael  * ELSE IF iavf_ptype_lookup[ptype].outer_ip == IAVF_RX_PTYPE_OUTER_IP
48966bc8e0fSJesse Brandeburg  *      Use the rest of the fields to look at the tunnels, inner protocols, etc
49066bc8e0fSJesse Brandeburg  * ELSE
49166bc8e0fSJesse Brandeburg  *      Use the enum iavf_rx_l2_ptype to decode the packet type
49266bc8e0fSJesse Brandeburg  * ENDIF
49366bc8e0fSJesse Brandeburg  */
49466bc8e0fSJesse Brandeburg 
49537dc8feaSJesse Brandeburg /* macro to make the table lines short, use explicit indexing with [PTYPE] */
49666bc8e0fSJesse Brandeburg #define IAVF_PTT(PTYPE, OUTER_IP, OUTER_IP_VER, OUTER_FRAG, T, TE, TEF, I, PL)\
49737dc8feaSJesse Brandeburg 	[PTYPE] = { \
49866bc8e0fSJesse Brandeburg 		1, \
49966bc8e0fSJesse Brandeburg 		IAVF_RX_PTYPE_OUTER_##OUTER_IP, \
50066bc8e0fSJesse Brandeburg 		IAVF_RX_PTYPE_OUTER_##OUTER_IP_VER, \
50166bc8e0fSJesse Brandeburg 		IAVF_RX_PTYPE_##OUTER_FRAG, \
50266bc8e0fSJesse Brandeburg 		IAVF_RX_PTYPE_TUNNEL_##T, \
50366bc8e0fSJesse Brandeburg 		IAVF_RX_PTYPE_TUNNEL_END_##TE, \
50466bc8e0fSJesse Brandeburg 		IAVF_RX_PTYPE_##TEF, \
50566bc8e0fSJesse Brandeburg 		IAVF_RX_PTYPE_INNER_PROT_##I, \
50666bc8e0fSJesse Brandeburg 		IAVF_RX_PTYPE_PAYLOAD_LAYER_##PL }
50766bc8e0fSJesse Brandeburg 
50837dc8feaSJesse Brandeburg #define IAVF_PTT_UNUSED_ENTRY(PTYPE) [PTYPE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
50966bc8e0fSJesse Brandeburg 
51066bc8e0fSJesse Brandeburg /* shorter macros makes the table fit but are terse */
51166bc8e0fSJesse Brandeburg #define IAVF_RX_PTYPE_NOF		IAVF_RX_PTYPE_NOT_FRAG
51266bc8e0fSJesse Brandeburg #define IAVF_RX_PTYPE_FRG		IAVF_RX_PTYPE_FRAG
51366bc8e0fSJesse Brandeburg #define IAVF_RX_PTYPE_INNER_PROT_TS	IAVF_RX_PTYPE_INNER_PROT_TIMESYNC
51466bc8e0fSJesse Brandeburg 
51537dc8feaSJesse Brandeburg /* Lookup table mapping the 8-bit HW PTYPE to the bit field for decoding */
51637dc8feaSJesse Brandeburg struct iavf_rx_ptype_decoded iavf_ptype_lookup[BIT(8)] = {
51766bc8e0fSJesse Brandeburg 	/* L2 Packet types */
51866bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(0),
51966bc8e0fSJesse Brandeburg 	IAVF_PTT(1,  L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY2),
52066bc8e0fSJesse Brandeburg 	IAVF_PTT(2,  L2, NONE, NOF, NONE, NONE, NOF, TS,   PAY2),
52166bc8e0fSJesse Brandeburg 	IAVF_PTT(3,  L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY2),
52266bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(4),
52366bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(5),
52466bc8e0fSJesse Brandeburg 	IAVF_PTT(6,  L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY2),
52566bc8e0fSJesse Brandeburg 	IAVF_PTT(7,  L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY2),
52666bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(8),
52766bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(9),
52866bc8e0fSJesse Brandeburg 	IAVF_PTT(10, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY2),
52966bc8e0fSJesse Brandeburg 	IAVF_PTT(11, L2, NONE, NOF, NONE, NONE, NOF, NONE, NONE),
53066bc8e0fSJesse Brandeburg 	IAVF_PTT(12, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
53166bc8e0fSJesse Brandeburg 	IAVF_PTT(13, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
53266bc8e0fSJesse Brandeburg 	IAVF_PTT(14, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
53366bc8e0fSJesse Brandeburg 	IAVF_PTT(15, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
53466bc8e0fSJesse Brandeburg 	IAVF_PTT(16, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
53566bc8e0fSJesse Brandeburg 	IAVF_PTT(17, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
53666bc8e0fSJesse Brandeburg 	IAVF_PTT(18, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
53766bc8e0fSJesse Brandeburg 	IAVF_PTT(19, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
53866bc8e0fSJesse Brandeburg 	IAVF_PTT(20, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
53966bc8e0fSJesse Brandeburg 	IAVF_PTT(21, L2, NONE, NOF, NONE, NONE, NOF, NONE, PAY3),
54066bc8e0fSJesse Brandeburg 
54166bc8e0fSJesse Brandeburg 	/* Non Tunneled IPv4 */
54266bc8e0fSJesse Brandeburg 	IAVF_PTT(22, IP, IPV4, FRG, NONE, NONE, NOF, NONE, PAY3),
54366bc8e0fSJesse Brandeburg 	IAVF_PTT(23, IP, IPV4, NOF, NONE, NONE, NOF, NONE, PAY3),
54466bc8e0fSJesse Brandeburg 	IAVF_PTT(24, IP, IPV4, NOF, NONE, NONE, NOF, UDP,  PAY4),
54566bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(25),
54666bc8e0fSJesse Brandeburg 	IAVF_PTT(26, IP, IPV4, NOF, NONE, NONE, NOF, TCP,  PAY4),
54766bc8e0fSJesse Brandeburg 	IAVF_PTT(27, IP, IPV4, NOF, NONE, NONE, NOF, SCTP, PAY4),
54866bc8e0fSJesse Brandeburg 	IAVF_PTT(28, IP, IPV4, NOF, NONE, NONE, NOF, ICMP, PAY4),
54966bc8e0fSJesse Brandeburg 
55066bc8e0fSJesse Brandeburg 	/* IPv4 --> IPv4 */
55166bc8e0fSJesse Brandeburg 	IAVF_PTT(29, IP, IPV4, NOF, IP_IP, IPV4, FRG, NONE, PAY3),
55266bc8e0fSJesse Brandeburg 	IAVF_PTT(30, IP, IPV4, NOF, IP_IP, IPV4, NOF, NONE, PAY3),
55366bc8e0fSJesse Brandeburg 	IAVF_PTT(31, IP, IPV4, NOF, IP_IP, IPV4, NOF, UDP,  PAY4),
55466bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(32),
55566bc8e0fSJesse Brandeburg 	IAVF_PTT(33, IP, IPV4, NOF, IP_IP, IPV4, NOF, TCP,  PAY4),
55666bc8e0fSJesse Brandeburg 	IAVF_PTT(34, IP, IPV4, NOF, IP_IP, IPV4, NOF, SCTP, PAY4),
55766bc8e0fSJesse Brandeburg 	IAVF_PTT(35, IP, IPV4, NOF, IP_IP, IPV4, NOF, ICMP, PAY4),
55866bc8e0fSJesse Brandeburg 
55966bc8e0fSJesse Brandeburg 	/* IPv4 --> IPv6 */
56066bc8e0fSJesse Brandeburg 	IAVF_PTT(36, IP, IPV4, NOF, IP_IP, IPV6, FRG, NONE, PAY3),
56166bc8e0fSJesse Brandeburg 	IAVF_PTT(37, IP, IPV4, NOF, IP_IP, IPV6, NOF, NONE, PAY3),
56266bc8e0fSJesse Brandeburg 	IAVF_PTT(38, IP, IPV4, NOF, IP_IP, IPV6, NOF, UDP,  PAY4),
56366bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(39),
56466bc8e0fSJesse Brandeburg 	IAVF_PTT(40, IP, IPV4, NOF, IP_IP, IPV6, NOF, TCP,  PAY4),
56566bc8e0fSJesse Brandeburg 	IAVF_PTT(41, IP, IPV4, NOF, IP_IP, IPV6, NOF, SCTP, PAY4),
56666bc8e0fSJesse Brandeburg 	IAVF_PTT(42, IP, IPV4, NOF, IP_IP, IPV6, NOF, ICMP, PAY4),
56766bc8e0fSJesse Brandeburg 
56866bc8e0fSJesse Brandeburg 	/* IPv4 --> GRE/NAT */
56966bc8e0fSJesse Brandeburg 	IAVF_PTT(43, IP, IPV4, NOF, IP_GRENAT, NONE, NOF, NONE, PAY3),
57066bc8e0fSJesse Brandeburg 
57166bc8e0fSJesse Brandeburg 	/* IPv4 --> GRE/NAT --> IPv4 */
57266bc8e0fSJesse Brandeburg 	IAVF_PTT(44, IP, IPV4, NOF, IP_GRENAT, IPV4, FRG, NONE, PAY3),
57366bc8e0fSJesse Brandeburg 	IAVF_PTT(45, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, NONE, PAY3),
57466bc8e0fSJesse Brandeburg 	IAVF_PTT(46, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, UDP,  PAY4),
57566bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(47),
57666bc8e0fSJesse Brandeburg 	IAVF_PTT(48, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, TCP,  PAY4),
57766bc8e0fSJesse Brandeburg 	IAVF_PTT(49, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, SCTP, PAY4),
57866bc8e0fSJesse Brandeburg 	IAVF_PTT(50, IP, IPV4, NOF, IP_GRENAT, IPV4, NOF, ICMP, PAY4),
57966bc8e0fSJesse Brandeburg 
58066bc8e0fSJesse Brandeburg 	/* IPv4 --> GRE/NAT --> IPv6 */
58166bc8e0fSJesse Brandeburg 	IAVF_PTT(51, IP, IPV4, NOF, IP_GRENAT, IPV6, FRG, NONE, PAY3),
58266bc8e0fSJesse Brandeburg 	IAVF_PTT(52, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, NONE, PAY3),
58366bc8e0fSJesse Brandeburg 	IAVF_PTT(53, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, UDP,  PAY4),
58466bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(54),
58566bc8e0fSJesse Brandeburg 	IAVF_PTT(55, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, TCP,  PAY4),
58666bc8e0fSJesse Brandeburg 	IAVF_PTT(56, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, SCTP, PAY4),
58766bc8e0fSJesse Brandeburg 	IAVF_PTT(57, IP, IPV4, NOF, IP_GRENAT, IPV6, NOF, ICMP, PAY4),
58866bc8e0fSJesse Brandeburg 
58966bc8e0fSJesse Brandeburg 	/* IPv4 --> GRE/NAT --> MAC */
59066bc8e0fSJesse Brandeburg 	IAVF_PTT(58, IP, IPV4, NOF, IP_GRENAT_MAC, NONE, NOF, NONE, PAY3),
59166bc8e0fSJesse Brandeburg 
59266bc8e0fSJesse Brandeburg 	/* IPv4 --> GRE/NAT --> MAC --> IPv4 */
59366bc8e0fSJesse Brandeburg 	IAVF_PTT(59, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, FRG, NONE, PAY3),
59466bc8e0fSJesse Brandeburg 	IAVF_PTT(60, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, NONE, PAY3),
59566bc8e0fSJesse Brandeburg 	IAVF_PTT(61, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, UDP,  PAY4),
59666bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(62),
59766bc8e0fSJesse Brandeburg 	IAVF_PTT(63, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, TCP,  PAY4),
59866bc8e0fSJesse Brandeburg 	IAVF_PTT(64, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, SCTP, PAY4),
59966bc8e0fSJesse Brandeburg 	IAVF_PTT(65, IP, IPV4, NOF, IP_GRENAT_MAC, IPV4, NOF, ICMP, PAY4),
60066bc8e0fSJesse Brandeburg 
60166bc8e0fSJesse Brandeburg 	/* IPv4 --> GRE/NAT -> MAC --> IPv6 */
60266bc8e0fSJesse Brandeburg 	IAVF_PTT(66, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, FRG, NONE, PAY3),
60366bc8e0fSJesse Brandeburg 	IAVF_PTT(67, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, NONE, PAY3),
60466bc8e0fSJesse Brandeburg 	IAVF_PTT(68, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, UDP,  PAY4),
60566bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(69),
60666bc8e0fSJesse Brandeburg 	IAVF_PTT(70, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, TCP,  PAY4),
60766bc8e0fSJesse Brandeburg 	IAVF_PTT(71, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, SCTP, PAY4),
60866bc8e0fSJesse Brandeburg 	IAVF_PTT(72, IP, IPV4, NOF, IP_GRENAT_MAC, IPV6, NOF, ICMP, PAY4),
60966bc8e0fSJesse Brandeburg 
61066bc8e0fSJesse Brandeburg 	/* IPv4 --> GRE/NAT --> MAC/VLAN */
61166bc8e0fSJesse Brandeburg 	IAVF_PTT(73, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, NONE, NOF, NONE, PAY3),
61266bc8e0fSJesse Brandeburg 
61366bc8e0fSJesse Brandeburg 	/* IPv4 ---> GRE/NAT -> MAC/VLAN --> IPv4 */
61466bc8e0fSJesse Brandeburg 	IAVF_PTT(74, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, FRG, NONE, PAY3),
61566bc8e0fSJesse Brandeburg 	IAVF_PTT(75, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, NONE, PAY3),
61666bc8e0fSJesse Brandeburg 	IAVF_PTT(76, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, UDP,  PAY4),
61766bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(77),
61866bc8e0fSJesse Brandeburg 	IAVF_PTT(78, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, TCP,  PAY4),
61966bc8e0fSJesse Brandeburg 	IAVF_PTT(79, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, SCTP, PAY4),
62066bc8e0fSJesse Brandeburg 	IAVF_PTT(80, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, ICMP, PAY4),
62166bc8e0fSJesse Brandeburg 
62266bc8e0fSJesse Brandeburg 	/* IPv4 -> GRE/NAT -> MAC/VLAN --> IPv6 */
62366bc8e0fSJesse Brandeburg 	IAVF_PTT(81, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, FRG, NONE, PAY3),
62466bc8e0fSJesse Brandeburg 	IAVF_PTT(82, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, NONE, PAY3),
62566bc8e0fSJesse Brandeburg 	IAVF_PTT(83, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, UDP,  PAY4),
62666bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(84),
62766bc8e0fSJesse Brandeburg 	IAVF_PTT(85, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, TCP,  PAY4),
62866bc8e0fSJesse Brandeburg 	IAVF_PTT(86, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, SCTP, PAY4),
62966bc8e0fSJesse Brandeburg 	IAVF_PTT(87, IP, IPV4, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, ICMP, PAY4),
63066bc8e0fSJesse Brandeburg 
63166bc8e0fSJesse Brandeburg 	/* Non Tunneled IPv6 */
63266bc8e0fSJesse Brandeburg 	IAVF_PTT(88, IP, IPV6, FRG, NONE, NONE, NOF, NONE, PAY3),
63366bc8e0fSJesse Brandeburg 	IAVF_PTT(89, IP, IPV6, NOF, NONE, NONE, NOF, NONE, PAY3),
634de58647bSAlexander Lobakin 	IAVF_PTT(90, IP, IPV6, NOF, NONE, NONE, NOF, UDP,  PAY4),
63566bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(91),
63666bc8e0fSJesse Brandeburg 	IAVF_PTT(92, IP, IPV6, NOF, NONE, NONE, NOF, TCP,  PAY4),
63766bc8e0fSJesse Brandeburg 	IAVF_PTT(93, IP, IPV6, NOF, NONE, NONE, NOF, SCTP, PAY4),
63866bc8e0fSJesse Brandeburg 	IAVF_PTT(94, IP, IPV6, NOF, NONE, NONE, NOF, ICMP, PAY4),
63966bc8e0fSJesse Brandeburg 
64066bc8e0fSJesse Brandeburg 	/* IPv6 --> IPv4 */
64166bc8e0fSJesse Brandeburg 	IAVF_PTT(95,  IP, IPV6, NOF, IP_IP, IPV4, FRG, NONE, PAY3),
64266bc8e0fSJesse Brandeburg 	IAVF_PTT(96,  IP, IPV6, NOF, IP_IP, IPV4, NOF, NONE, PAY3),
64366bc8e0fSJesse Brandeburg 	IAVF_PTT(97,  IP, IPV6, NOF, IP_IP, IPV4, NOF, UDP,  PAY4),
64466bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(98),
64566bc8e0fSJesse Brandeburg 	IAVF_PTT(99,  IP, IPV6, NOF, IP_IP, IPV4, NOF, TCP,  PAY4),
64666bc8e0fSJesse Brandeburg 	IAVF_PTT(100, IP, IPV6, NOF, IP_IP, IPV4, NOF, SCTP, PAY4),
64766bc8e0fSJesse Brandeburg 	IAVF_PTT(101, IP, IPV6, NOF, IP_IP, IPV4, NOF, ICMP, PAY4),
64866bc8e0fSJesse Brandeburg 
64966bc8e0fSJesse Brandeburg 	/* IPv6 --> IPv6 */
65066bc8e0fSJesse Brandeburg 	IAVF_PTT(102, IP, IPV6, NOF, IP_IP, IPV6, FRG, NONE, PAY3),
65166bc8e0fSJesse Brandeburg 	IAVF_PTT(103, IP, IPV6, NOF, IP_IP, IPV6, NOF, NONE, PAY3),
65266bc8e0fSJesse Brandeburg 	IAVF_PTT(104, IP, IPV6, NOF, IP_IP, IPV6, NOF, UDP,  PAY4),
65366bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(105),
65466bc8e0fSJesse Brandeburg 	IAVF_PTT(106, IP, IPV6, NOF, IP_IP, IPV6, NOF, TCP,  PAY4),
65566bc8e0fSJesse Brandeburg 	IAVF_PTT(107, IP, IPV6, NOF, IP_IP, IPV6, NOF, SCTP, PAY4),
65666bc8e0fSJesse Brandeburg 	IAVF_PTT(108, IP, IPV6, NOF, IP_IP, IPV6, NOF, ICMP, PAY4),
65766bc8e0fSJesse Brandeburg 
65866bc8e0fSJesse Brandeburg 	/* IPv6 --> GRE/NAT */
65966bc8e0fSJesse Brandeburg 	IAVF_PTT(109, IP, IPV6, NOF, IP_GRENAT, NONE, NOF, NONE, PAY3),
66066bc8e0fSJesse Brandeburg 
66166bc8e0fSJesse Brandeburg 	/* IPv6 --> GRE/NAT -> IPv4 */
66266bc8e0fSJesse Brandeburg 	IAVF_PTT(110, IP, IPV6, NOF, IP_GRENAT, IPV4, FRG, NONE, PAY3),
66366bc8e0fSJesse Brandeburg 	IAVF_PTT(111, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, NONE, PAY3),
66466bc8e0fSJesse Brandeburg 	IAVF_PTT(112, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, UDP,  PAY4),
66566bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(113),
66666bc8e0fSJesse Brandeburg 	IAVF_PTT(114, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, TCP,  PAY4),
66766bc8e0fSJesse Brandeburg 	IAVF_PTT(115, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, SCTP, PAY4),
66866bc8e0fSJesse Brandeburg 	IAVF_PTT(116, IP, IPV6, NOF, IP_GRENAT, IPV4, NOF, ICMP, PAY4),
66966bc8e0fSJesse Brandeburg 
67066bc8e0fSJesse Brandeburg 	/* IPv6 --> GRE/NAT -> IPv6 */
67166bc8e0fSJesse Brandeburg 	IAVF_PTT(117, IP, IPV6, NOF, IP_GRENAT, IPV6, FRG, NONE, PAY3),
67266bc8e0fSJesse Brandeburg 	IAVF_PTT(118, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, NONE, PAY3),
67366bc8e0fSJesse Brandeburg 	IAVF_PTT(119, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, UDP,  PAY4),
67466bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(120),
67566bc8e0fSJesse Brandeburg 	IAVF_PTT(121, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, TCP,  PAY4),
67666bc8e0fSJesse Brandeburg 	IAVF_PTT(122, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, SCTP, PAY4),
67766bc8e0fSJesse Brandeburg 	IAVF_PTT(123, IP, IPV6, NOF, IP_GRENAT, IPV6, NOF, ICMP, PAY4),
67866bc8e0fSJesse Brandeburg 
67966bc8e0fSJesse Brandeburg 	/* IPv6 --> GRE/NAT -> MAC */
68066bc8e0fSJesse Brandeburg 	IAVF_PTT(124, IP, IPV6, NOF, IP_GRENAT_MAC, NONE, NOF, NONE, PAY3),
68166bc8e0fSJesse Brandeburg 
68266bc8e0fSJesse Brandeburg 	/* IPv6 --> GRE/NAT -> MAC -> IPv4 */
68366bc8e0fSJesse Brandeburg 	IAVF_PTT(125, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, FRG, NONE, PAY3),
68466bc8e0fSJesse Brandeburg 	IAVF_PTT(126, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, NONE, PAY3),
68566bc8e0fSJesse Brandeburg 	IAVF_PTT(127, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, UDP,  PAY4),
68666bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(128),
68766bc8e0fSJesse Brandeburg 	IAVF_PTT(129, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, TCP,  PAY4),
68866bc8e0fSJesse Brandeburg 	IAVF_PTT(130, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, SCTP, PAY4),
68966bc8e0fSJesse Brandeburg 	IAVF_PTT(131, IP, IPV6, NOF, IP_GRENAT_MAC, IPV4, NOF, ICMP, PAY4),
69066bc8e0fSJesse Brandeburg 
69166bc8e0fSJesse Brandeburg 	/* IPv6 --> GRE/NAT -> MAC -> IPv6 */
69266bc8e0fSJesse Brandeburg 	IAVF_PTT(132, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, FRG, NONE, PAY3),
69366bc8e0fSJesse Brandeburg 	IAVF_PTT(133, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, NONE, PAY3),
69466bc8e0fSJesse Brandeburg 	IAVF_PTT(134, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, UDP,  PAY4),
69566bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(135),
69666bc8e0fSJesse Brandeburg 	IAVF_PTT(136, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, TCP,  PAY4),
69766bc8e0fSJesse Brandeburg 	IAVF_PTT(137, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, SCTP, PAY4),
69866bc8e0fSJesse Brandeburg 	IAVF_PTT(138, IP, IPV6, NOF, IP_GRENAT_MAC, IPV6, NOF, ICMP, PAY4),
69966bc8e0fSJesse Brandeburg 
70066bc8e0fSJesse Brandeburg 	/* IPv6 --> GRE/NAT -> MAC/VLAN */
70166bc8e0fSJesse Brandeburg 	IAVF_PTT(139, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, NONE, NOF, NONE, PAY3),
70266bc8e0fSJesse Brandeburg 
70366bc8e0fSJesse Brandeburg 	/* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv4 */
70466bc8e0fSJesse Brandeburg 	IAVF_PTT(140, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, FRG, NONE, PAY3),
70566bc8e0fSJesse Brandeburg 	IAVF_PTT(141, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, NONE, PAY3),
70666bc8e0fSJesse Brandeburg 	IAVF_PTT(142, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, UDP,  PAY4),
70766bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(143),
70866bc8e0fSJesse Brandeburg 	IAVF_PTT(144, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, TCP,  PAY4),
70966bc8e0fSJesse Brandeburg 	IAVF_PTT(145, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, SCTP, PAY4),
71066bc8e0fSJesse Brandeburg 	IAVF_PTT(146, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV4, NOF, ICMP, PAY4),
71166bc8e0fSJesse Brandeburg 
71266bc8e0fSJesse Brandeburg 	/* IPv6 --> GRE/NAT -> MAC/VLAN --> IPv6 */
71366bc8e0fSJesse Brandeburg 	IAVF_PTT(147, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, FRG, NONE, PAY3),
71466bc8e0fSJesse Brandeburg 	IAVF_PTT(148, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, NONE, PAY3),
71566bc8e0fSJesse Brandeburg 	IAVF_PTT(149, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, UDP,  PAY4),
71666bc8e0fSJesse Brandeburg 	IAVF_PTT_UNUSED_ENTRY(150),
71766bc8e0fSJesse Brandeburg 	IAVF_PTT(151, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, TCP,  PAY4),
71866bc8e0fSJesse Brandeburg 	IAVF_PTT(152, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, SCTP, PAY4),
71966bc8e0fSJesse Brandeburg 	IAVF_PTT(153, IP, IPV6, NOF, IP_GRENAT_MAC_VLAN, IPV6, NOF, ICMP, PAY4),
72066bc8e0fSJesse Brandeburg 
72166bc8e0fSJesse Brandeburg 	/* unused entries */
72237dc8feaSJesse Brandeburg 	[154 ... 255] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
72366bc8e0fSJesse Brandeburg };
72466bc8e0fSJesse Brandeburg 
72566bc8e0fSJesse Brandeburg /**
72666bc8e0fSJesse Brandeburg  * iavf_aq_send_msg_to_pf
72766bc8e0fSJesse Brandeburg  * @hw: pointer to the hardware structure
72866bc8e0fSJesse Brandeburg  * @v_opcode: opcodes for VF-PF communication
72966bc8e0fSJesse Brandeburg  * @v_retval: return error code
73066bc8e0fSJesse Brandeburg  * @msg: pointer to the msg buffer
73166bc8e0fSJesse Brandeburg  * @msglen: msg length
73266bc8e0fSJesse Brandeburg  * @cmd_details: pointer to command details
73366bc8e0fSJesse Brandeburg  *
73466bc8e0fSJesse Brandeburg  * Send message to PF driver using admin queue. By default, this message
73566bc8e0fSJesse Brandeburg  * is sent asynchronously, i.e. iavf_asq_send_command() does not wait for
73666bc8e0fSJesse Brandeburg  * completion before returning.
73766bc8e0fSJesse Brandeburg  **/
iavf_aq_send_msg_to_pf(struct iavf_hw * hw,enum virtchnl_ops v_opcode,enum iavf_status v_retval,u8 * msg,u16 msglen,struct iavf_asq_cmd_details * cmd_details)73880754bbcSSergey Nemov enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
73966bc8e0fSJesse Brandeburg 					enum virtchnl_ops v_opcode,
74080754bbcSSergey Nemov 					enum iavf_status v_retval,
74180754bbcSSergey Nemov 					u8 *msg, u16 msglen,
7427af36e32SAlice Michael 					struct iavf_asq_cmd_details *cmd_details)
74366bc8e0fSJesse Brandeburg {
7447af36e32SAlice Michael 	struct iavf_asq_cmd_details details;
7457af36e32SAlice Michael 	struct iavf_aq_desc desc;
74680754bbcSSergey Nemov 	enum iavf_status status;
74766bc8e0fSJesse Brandeburg 
7487af36e32SAlice Michael 	iavf_fill_default_direct_cmd_desc(&desc, iavf_aqc_opc_send_msg_to_pf);
7497af36e32SAlice Michael 	desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_SI);
75066bc8e0fSJesse Brandeburg 	desc.cookie_high = cpu_to_le32(v_opcode);
75166bc8e0fSJesse Brandeburg 	desc.cookie_low = cpu_to_le32(v_retval);
75266bc8e0fSJesse Brandeburg 	if (msglen) {
7537af36e32SAlice Michael 		desc.flags |= cpu_to_le16((u16)(IAVF_AQ_FLAG_BUF
7547af36e32SAlice Michael 						| IAVF_AQ_FLAG_RD));
7557af36e32SAlice Michael 		if (msglen > IAVF_AQ_LARGE_BUF)
7567af36e32SAlice Michael 			desc.flags |= cpu_to_le16((u16)IAVF_AQ_FLAG_LB);
75766bc8e0fSJesse Brandeburg 		desc.datalen = cpu_to_le16(msglen);
75866bc8e0fSJesse Brandeburg 	}
75966bc8e0fSJesse Brandeburg 	if (!cmd_details) {
76066bc8e0fSJesse Brandeburg 		memset(&details, 0, sizeof(details));
76166bc8e0fSJesse Brandeburg 		details.async = true;
76266bc8e0fSJesse Brandeburg 		cmd_details = &details;
76366bc8e0fSJesse Brandeburg 	}
76466bc8e0fSJesse Brandeburg 	status = iavf_asq_send_command(hw, &desc, msg, msglen, cmd_details);
76566bc8e0fSJesse Brandeburg 	return status;
76666bc8e0fSJesse Brandeburg }
76766bc8e0fSJesse Brandeburg 
76866bc8e0fSJesse Brandeburg /**
76966bc8e0fSJesse Brandeburg  * iavf_vf_parse_hw_config
77066bc8e0fSJesse Brandeburg  * @hw: pointer to the hardware structure
77166bc8e0fSJesse Brandeburg  * @msg: pointer to the virtual channel VF resource structure
77266bc8e0fSJesse Brandeburg  *
77366bc8e0fSJesse Brandeburg  * Given a VF resource message from the PF, populate the hw struct
77466bc8e0fSJesse Brandeburg  * with appropriate information.
77566bc8e0fSJesse Brandeburg  **/
iavf_vf_parse_hw_config(struct iavf_hw * hw,struct virtchnl_vf_resource * msg)77666bc8e0fSJesse Brandeburg void iavf_vf_parse_hw_config(struct iavf_hw *hw,
77766bc8e0fSJesse Brandeburg 			     struct virtchnl_vf_resource *msg)
77866bc8e0fSJesse Brandeburg {
77966bc8e0fSJesse Brandeburg 	struct virtchnl_vsi_resource *vsi_res;
78066bc8e0fSJesse Brandeburg 	int i;
78166bc8e0fSJesse Brandeburg 
78266bc8e0fSJesse Brandeburg 	vsi_res = &msg->vsi_res[0];
78366bc8e0fSJesse Brandeburg 
78466bc8e0fSJesse Brandeburg 	hw->dev_caps.num_vsis = msg->num_vsis;
78566bc8e0fSJesse Brandeburg 	hw->dev_caps.num_rx_qp = msg->num_queue_pairs;
78666bc8e0fSJesse Brandeburg 	hw->dev_caps.num_tx_qp = msg->num_queue_pairs;
78766bc8e0fSJesse Brandeburg 	hw->dev_caps.num_msix_vectors_vf = msg->max_vectors;
78866bc8e0fSJesse Brandeburg 	hw->dev_caps.dcb = msg->vf_cap_flags &
78966bc8e0fSJesse Brandeburg 			   VIRTCHNL_VF_OFFLOAD_L2;
79066bc8e0fSJesse Brandeburg 	hw->dev_caps.fcoe = 0;
79166bc8e0fSJesse Brandeburg 	for (i = 0; i < msg->num_vsis; i++) {
79266bc8e0fSJesse Brandeburg 		if (vsi_res->vsi_type == VIRTCHNL_VSI_SRIOV) {
79366bc8e0fSJesse Brandeburg 			ether_addr_copy(hw->mac.perm_addr,
79466bc8e0fSJesse Brandeburg 					vsi_res->default_mac_addr);
79566bc8e0fSJesse Brandeburg 			ether_addr_copy(hw->mac.addr,
79666bc8e0fSJesse Brandeburg 					vsi_res->default_mac_addr);
79766bc8e0fSJesse Brandeburg 		}
79866bc8e0fSJesse Brandeburg 		vsi_res++;
79966bc8e0fSJesse Brandeburg 	}
80066bc8e0fSJesse Brandeburg }
801