[NIC_MBOX_MSG_RESET_STAT_COUNTER] = "NIC_MBOX_MSG_RESET_STAT_COUNTER",
[NIC_MBOX_MSG_CFG_DONE] = "NIC_MBOX_MSG_CFG_DONE",
[NIC_MBOX_MSG_SHUTDOWN] = "NIC_MBOX_MSG_SHUTDOWN",
+ [NIC_MBOX_MSG_RES_BIT] = "NIC_MBOX_MSG_RES_BIT",
+ [NIC_MBOX_MSG_RSS_SIZE_RES_BIT] = "NIC_MBOX_MSG_RSS_SIZE",
+ [NIC_MBOX_MSG_ALLOC_SQS_RES_BIT] = "NIC_MBOX_MSG_ALLOC_SQS",
};
static inline const char * __attribute__((unused))
case NIC_MBOX_MSG_NACK:
nic->pf_nacked = true;
break;
- case NIC_MBOX_MSG_RSS_SIZE:
+ case NIC_MBOX_MSG_RSS_SIZE_RES_BIT:
nic->rss_info.rss_size = mbx.rss_size.ind_tbl_size;
nic->pf_acked = true;
break;
nic->speed = mbx.link_status.speed;
nic->pf_acked = true;
break;
+ case NIC_MBOX_MSG_ALLOC_SQS_RES_BIT:
+ assert_primary(nic);
+ if (mbx.sqs_alloc.qs_count != nic->sqs_count) {
+ nicvf_log_error("Received %" PRIu8 "/%" PRIu8
+ " secondary qsets",
+ mbx.sqs_alloc.qs_count,
+ nic->sqs_count);
+ abort();
+ }
+ for (i = 0; i < mbx.sqs_alloc.qs_count; i++) {
+ if (mbx.sqs_alloc.svf[i] != nic->snicvf[i]->vf_id) {
+ nicvf_log_error("Received secondary qset[%zu] "
+ "ID %" PRIu8 " expected %"
+ PRIu8, i, mbx.sqs_alloc.svf[i],
+ nic->snicvf[i]->vf_id);
+ abort();
+ }
+ }
+ nic->pf_acked = true;
+ break;
default:
nicvf_log_error("Invalid message from PF, msg_id=0x%hhx %s",
mbx.msg.msg, nicvf_mbox_msg_str(mbx.msg.msg));
/* Send a mailbox msg to PF to config Qset */
mbx.msg.msg = NIC_MBOX_MSG_QS_CFG;
mbx.qs.num = nic->vf_id;
+ mbx.qs.sqs_count = nic->sqs_count;
mbx.qs.cfg = qs_cfg->value;
return nicvf_mbox_send_msg_to_pf(nic, &mbx);
}
+int
+nicvf_mbox_request_sqs(struct nicvf *nic)
+{
+ struct nic_mbx mbx = { .msg = { 0 } };
+ size_t i;
+
+ assert_primary(nic);
+ assert(nic->sqs_count > 0);
+ assert(nic->sqs_count <= MAX_SQS_PER_VF);
+
+ mbx.sqs_alloc.msg = NIC_MBOX_MSG_ALLOC_SQS;
+ mbx.sqs_alloc.spec = 1;
+ mbx.sqs_alloc.qs_count = nic->sqs_count;
+
+ /* Set no of Rx/Tx queues in each of the SQsets */
+ for (i = 0; i < nic->sqs_count; i++)
+ mbx.sqs_alloc.svf[i] = nic->snicvf[i]->vf_id;
+
+ return nicvf_mbox_send_msg_to_pf(nic, &mbx);
+}
+
int
nicvf_mbox_rq_drop_config(struct nicvf *nic, uint16_t qidx, bool enable)
{
#include <stdint.h>
#include "nicvf_plat.h"
+#include "../nicvf_struct.h"
/* PF <--> VF Mailbox communication
* Two 64bit registers are shared between PF and VF for each VF
#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 0xF0 /* VF configuration done */
-#define NIC_MBOX_MSG_SHUTDOWN 0xF1 /* VF is being shutdown */
+#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 /* Reset bit from PF */
#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;
uint32_t speed;
};
+/* Allocate additional SQS to VF */
+struct sqs_alloc {
+ uint8_t msg;
+ uint8_t spec;
+ uint8_t qs_count;
+ uint8_t svf[MAX_SQS_PER_VF];
+};
+
/* Set interface in loopback mode */
struct set_loopback {
uint8_t msg;
struct rss_sz_msg rss_size;
struct rss_cfg_msg rss_cfg;
struct bgx_link_status link_status;
+ struct sqs_alloc sqs_alloc;
struct set_loopback lbk;
struct reset_stat_cfg reset_stat;
};
int nicvf_handle_mbx_intr(struct nicvf *nic);
int nicvf_mbox_check_pf_ready(struct nicvf *nic);
int nicvf_mbox_qset_config(struct nicvf *nic, struct pf_qs_cfg *qs_cfg);
+int nicvf_mbox_request_sqs(struct nicvf *nic);
int nicvf_mbox_rq_config(struct nicvf *nic, uint16_t qidx,
struct pf_rq_cfg *pf_rq_cfg);
int nicvf_mbox_sq_config(struct nicvf *nic, uint16_t qidx);