File sync_mailbox_defs_with_linux_pf_drv.patch of Package odp-thunderx

diff -Nuar odp-thunderx.old/platform/linux-thunder/include/thunder/nicvf/nic_mbox.h odp-thunderx/platform/linux-thunder/include/thunder/nicvf/nic_mbox.h
--- odp-thunderx.old/platform/linux-thunder/include/thunder/nicvf/nic_mbox.h	2018-03-16 13:59:41.700262595 +0100
+++ odp-thunderx/platform/linux-thunder/include/thunder/nicvf/nic_mbox.h	2018-03-16 14:01:45.604837317 +0100
@@ -81,16 +81,10 @@
 #define	NIC_MBOX_MSG_ALLOC_SQS		0x12	/* Allocate secondary Qset */
 #define	NIC_MBOX_MSG_LOOPBACK		0x16	/* Set interface in loopback */
 #define	NIC_MBOX_MSG_RESET_STAT_COUNTER 0x17	/* Reset statistics counters */
-#define	NIC_MBOX_MSG_CFG_DONE		0x7E	/* VF configuration done */
-#define	NIC_MBOX_MSG_SHUTDOWN		0x7F	/* VF is being shutdown */
-#define	NIC_MBOX_MSG_RES_BIT		0x80	/* Mark for response message */
+#define	NIC_MBOX_MSG_CFG_DONE		0xF0	/* VF configuration done */
+#define	NIC_MBOX_MSG_SHUTDOWN		0xF1	/* VF is being shutdown */
 #define	NIC_MBOX_MSG_MAX		0x100	/* Maximum number of messages */
 
-#define NIC_MBOX_MSG_RSS_SIZE_RES_BIT \
-	(NIC_MBOX_MSG_RSS_SIZE | NIC_MBOX_MSG_RES_BIT)
-#define NIC_MBOX_MSG_ALLOC_SQS_RES_BIT \
-	(NIC_MBOX_MSG_ALLOC_SQS | NIC_MBOX_MSG_RES_BIT)
-
 /* Get vNIC VF configuration */
 struct nic_cfg_msg {
 	uint8_t    msg;
diff -Nuar odp-thunderx.old/platform/linux-thunder/thunder/nicvf/nic_mbox.c odp-thunderx/platform/linux-thunder/thunder/nicvf/nic_mbox.c
--- odp-thunderx.old/platform/linux-thunder/thunder/nicvf/nic_mbox.c	2018-03-16 13:59:41.700262595 +0100
+++ odp-thunderx/platform/linux-thunder/thunder/nicvf/nic_mbox.c	2018-03-16 14:03:27.785309994 +0100
@@ -100,13 +100,13 @@
 	case NIC_MBOX_MSG_READY:
 	case NIC_MBOX_MSG_ACK:
 	case NIC_MBOX_MSG_NACK:
-	case NIC_MBOX_MSG_RSS_SIZE | NIC_MBOX_MSG_RES_BIT:
+	case NIC_MBOX_MSG_RSS_SIZE:
 #ifdef VNIC_MULTI_QSET_SUPPORT
-	case NIC_MBOX_MSG_ALLOC_SQS | NIC_MBOX_MSG_RES_BIT:
+	case NIC_MBOX_MSG_ALLOC_SQS:
 #endif
 	case NIC_MBOX_MSG_BGX_LINK_CHANGE:
 		DBGV3("VF Mbox msg received msg_id=0x%x %s\n",
-		      msg, msg_names[msg & (~NIC_MBOX_MSG_RES_BIT)]);
+		      msg, msg_names[msg]);
 		/* overwrite the message buffer so we won't receive it again */
 		nicvf_vf_reg_write(qset, NIC_VF_PF_MAILBOX_0_1, NIC_MBOX_MSG_INVALID);
 
@@ -124,8 +124,7 @@
 
 	default:
 		/* in other cases it means message was invalid or not received */
-		DBG("Unknown Mbox msg received msg_id=0x%x\n",
-		    msg & (~NIC_MBOX_MSG_RES_BIT));
+		DBG("Unknown Mbox msg received msg_id=0x%x\n", msg);
 		ret = -1;
 		break;
 	}
@@ -173,7 +172,7 @@
 	int i;
 
 	DBG("Sending msg to PF msg=0x%02x %s\n", mbx->msg.msg,
-	     msg_names[mbx->msg.msg & (~NIC_MBOX_MSG_RES_BIT)]);
+	     msg_names[mbx->msg.msg]);
 
 	mbx_addr = NIC_VF_PF_MAILBOX_0_1;
 	mbx_ptr = (uint64_t *)mbx;
@@ -201,14 +200,16 @@
 
 	/* because of BUG in PF<->VF mbox design, some message transactions from
 	 * VF-> PF can be overwrited by asynchronius PF->VF messages. Therefore
-	 * in case of missing response, we need to try again */
+	 * in case of missing response, we have to try again */
 	for(try = 0; try < 3 ; try++) {
 		nicvf_mbox_send_msg_to_pf_raw(qset, mbx);
 		ret = nicvf_mbox_recv_response(qset, res);
 		if (!ret)
 			break; /* Success */
-		ERR("Missing response! Retrying MBX transaction ... %zu\n", try+1);
+		DBG("Missing response! Retrying MBX transaction ... %zu\n", try+1);
 	}
+	if (ret)
+		ERR("Missing response 3 times in row. PF not responding?\n");
 
 	return ret;
 }
@@ -297,7 +298,7 @@
 	mbx.rss_size.vf_id = qset->vf_id;
 
 	if (nicvf_mbox_send_msg_to_pf(qset, &mbx, &res) ||
-	    res.msg.msg != (NIC_MBOX_MSG_RSS_SIZE | NIC_MBOX_MSG_RES_BIT))
+	    res.msg.msg != (NIC_MBOX_MSG_RSS_SIZE))
 		return -1;
 
 	return res.rss_size.ind_tbl_size;
@@ -467,7 +468,7 @@
 	mbx.msg.msg = NIC_MBOX_MSG_RQ_BP_CFG;
 	mbx.rq.qs_num = qset->vf_id;
 	mbx.rq.rq_num = qset->qset_idx;
-	mbx.rq.cfg = (1ULL << 63) | (1ULL << 62) | (0xff << 16) | (0xff << 8) | (qset->vf_id << 0);
+	mbx.rq.cfg = (1ULL << 63) | (1ULL << 62) | (qset->vf_id << 0);
 	if (nicvf_mbox_send_msg_to_pf(qset, &mbx, &res) ||
 	    res.msg.msg != NIC_MBOX_MSG_ACK)
 		return -1;
@@ -495,12 +496,12 @@
 	}
 
 	if (nicvf_mbox_send_msg_to_pf(&nic->qset[0], &mbx, &res) ||
-	    res.msg.msg != (NIC_MBOX_MSG_ALLOC_SQS | NIC_MBOX_MSG_RES_BIT)) {
+	    res.msg.msg != (NIC_MBOX_MSG_ALLOC_SQS)) {
 		ERR("Invalid or missing response for alloc SQS\n");
 		return -1;
 	}
 
-	ERR("SQS alloc response received qs_count=%"PRIu8"\n",
+	NFO("SQS alloc response received qs_count=%"PRIu8"\n",
 	    res.sqs_alloc.qs_count);
 
 	if (res.sqs_alloc.qs_count != nic->qset_cnt - 1) {
@@ -541,4 +542,3 @@
 	union nic_mbx mbx = { .msg.msg = NIC_MBOX_MSG_CFG_DONE, };
 	nicvf_mbox_send_async_msg_to_pf(qset, &mbx);
 }
-