From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0050.outbound.protection.outlook.com [104.47.40.50]) by dpdk.org (Postfix) with ESMTP id 0CF7D5A57 for ; Fri, 26 Aug 2016 18:55:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lNlwKmWcussdA3M3h53xtojZ4Zv15SpoZWw60Dhczpk=; b=OYKK5zvPTOrooskOF9EAFiMeNCbqCADnrPuZODZ4whyYoTjua0BoJ/egWoWOIQSjAvfcgriSTRj/JyOAFqxC2sPmfrqK5ycTIS4KbHi/OyzlGKa5NfFRB+XyA865U/evEMR7cm8Q0LCZwVb33X9XJighIwwO1/VWJAJZu1SIRTA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Kamil.Rytarowski@cavium.com; Received: from cavium1.semihalf.local (31.172.191.173) by CY4PR07MB3064.namprd07.prod.outlook.com (10.172.116.145) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.549.15; Fri, 26 Aug 2016 16:54:58 +0000 From: Kamil Rytarowski To: CC: , , , , , Kamil Rytarowski Date: Fri, 26 Aug 2016 18:53:59 +0200 Message-ID: <1472230448-17490-5-git-send-email-krytarowski@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472230448-17490-1-git-send-email-krytarowski@caviumnetworks.com> References: <1472230448-17490-1-git-send-email-krytarowski@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: HE1PR0201CA0008.eurprd02.prod.outlook.com (10.165.229.18) To CY4PR07MB3064.namprd07.prod.outlook.com (10.172.116.145) X-MS-Office365-Filtering-Correlation-Id: 299d99f9-818e-4b3e-3a49-08d3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WMVTwv+zG6jLhKLJWmYM9Egg/44lALcAED8et9dwD5w+ojpgXRK7hLA5j50wW4=; 20:UtNYBBpu5nGWrOuD3mOsLeVCXxAhk/BMLlejtfP2scLzJKtXajqLK4eMDx4cd0bW5JKGDlKc1MAVuquJVDzj5VdJXmSrpQTwQ7fxDirCokLlsp8rGC1En7dVvw/uAtOhr20YObgxS3EXpzv6nngL0flSnv8Dk62yS2+FKlr7LDMDyBbXml76kXGotq/F9+tUGk8aSayCVdvrFOBYkYD7X/TuzkqboAbxVKc/H5uyzkhPREEI5JDEcNt5KcGrHPJO5xT+NCT4zRgw7z4Aq/Pb9KJhdIA/EFgeBB6xOtDa66WQMHLucZIee8jP8ylWKGEEiQJQgtR6AEsxmAktx72lRJnxFlJr7IenM8dkmPrK36Dwz0zHzACK7zF+AcCO+iC/S9ns/84okPhn552alnLq5eF7cBQlMx7MjUOCGyHHDcrlJQ+MbGwPEuo5zcKbioxAvWKqNYApFQIGUZBvS0JDiqO3LvAzTzDzbTBbRqZeCQoccYfu2kRr1LEiBLWOVgPXQnefZtWoo8F88Rjbqu9ntO/+T3+A5dzUQPfSBcKdLBaKU5L4mGzGwYeHrL4rEpVeyqjAg6oDDtEIKwWsOrw2yltuiKPoZcjE6Kxgk1wozM8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:CY4PR07MB3064; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3064; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3064; 4:0SvJ+84jVBJ5XY6yZ7q0IRoenFBuL5WspjIbg3fpKPnDgxyDyQOD/OneCCd34AO77p1LSBp19BNGWKLpZgt9GgRaGt5srSX8WDcA8Itd8zguDLSljqyn8LFjTh7j0eiYidvS/UJGufNEOvF23BNyjsxlqCojiYsuzGur7FV5ylTydmw5x73WUOQGUPFJ3Zxod9RBNbNkE5dwYkdrSnoNfm474jTbHHup5sqtNbA9mIANvz0IeWI3n1dyElnJ2NA+mq7RicGIFiGQNbTaF7VGRpnzHyv1H7R2rAMQsXlldkG9w6nec/y6B7DhOd4vqIqdjo+Ob7Ny2dUwbGuHfsbrLvtcxMfq7yvC7XebgGY2WfqEwTKDzjDX71fknbFqtoqZvmqJfZNw8r9ehqObUiZXqg== X-Forefront-PRVS: 00462943DE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(81156014)(36756003)(77096005)(189998001)(2906002)(229853001)(2351001)(105586002)(8676002)(101416001)(92566002)(5660300001)(81166006)(6116002)(4001430100002)(2950100001)(7736002)(47776003)(4326007)(66066001)(586003)(50466002)(106356001)(50226002)(5003940100001)(19580405001)(19580395003)(575784001)(305945005)(50986999)(110136002)(76176999)(7846002)(48376002)(68736007)(42186005)(3846002)(107886002)(33646002)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3064; H:cavium1.semihalf.local; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3064; 23:8+ktJ6L3qkbUBxRy3OtAsygnj0CQfJW91W337T10p?= =?us-ascii?Q?/6K3BoVD0g9lN18NPj5IzlrzhH7GZpA7HYUsEBhm6gdolnhK+8ZQ3ZkbwboG?= =?us-ascii?Q?y3aSqvRQY37YZdNtGFGEZ7h08JjXP5ikbRVCESSFsYQDuPLpmUL/SRSahovk?= =?us-ascii?Q?q+DuiJw0czZC6RVhapaH19OvcAflxDfIfFVA4UjcrbSv67Sk56Bjn8lknlLA?= =?us-ascii?Q?YQpKOBP8bqK6HAfPIa5+Rpnr4zjZzZgLqTTP06tY6PyZQx/DQVRlfinUggQp?= =?us-ascii?Q?6+7ojmLGWSstrJZEtw5fQz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4PR07MB3064; 6:y+fkCL+6uFaFClPaNFt/wV7T2f1eEKqz7gotGBDU1ZbQKaVqEmNv+ayyl8muDqYHSDtk9GdouvAZ+pAvyy7pdxrK8BpDVnLPeZkXHaCGcQKwW93vDgc0+gqwD8sPTOWI2ZKQzouEgAOLBIWNYwlqOEvY5yWGARI/jqRFnyetQ7fYb6Q3gWqYI2T8QxV3gCxdOxRyj01dd4cOQDNtAcxYft+l2EPU1d7LgdbHKu8D8NfP9jSakE7vcVgaBTrwa6W1Q9K55clQ8Uztn9quoEY0TfFQGwAi3zSndEEzK0LjMns=; 5:KIgJ1wJEeZYvbZ99s9GAz0qVGBEMEFGFjydZL0bPRCxb4TwzJLLDA6Zb4iYkpLVjDv4JCDn2Z011wu++Z7QsNS855o1pBvMZZBhMHHrSaY7ONLapNTYLm46zEhQ4W4NNDpGcbJMeHoD6dB+I4jMRyA==; 24:Mk/Ih640S/rh2zvFqoXOglgu9gKeDOuQZXgLg9IOBTLKl9mb/DErwh1WqNsmzbFTlWCyX37uX74p2Qyc4oUE2YCCxWxwB4Ig0+a51Z2UsVg=; 7:xwDB/ZwvAr2YES9qrSsLw9trhwEvppszGdRTEmE8slLgL3tD4uyvrLfFAwOrKtQtm+1DeGV0pHyrE4X3S/yzbx5tN9pNCawdA+9ncrmTZWG8QRMuF3YR8ZkxrUa7zwymRjCJlXozcdRBA/bvLjPgmucyfsar4Mwj7xQj8i1QpAYObyEfefm4dVUE7QeuIjD/a2PdPizv0wQhbtuGpok9ROart7lF7ipxVc705its+LaZoQwGAWUHY0TvHZi4TcrP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2016 16:54:58.8061 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3064 Subject: [dpdk-dev] [PATCH 04/13] net/thunderx/base: add secondary queue set support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Aug 2016 16:55:05 -0000 From: Kamil Rytarowski Changes: - add new message sqs_alloc in mailbox - add a queue container to hold secondary qsets. - add nicvf_mbox_request_sqs - handle new mailbox messages for secondary queue set support - register secondary queue sets for furthe reuse - register the number secondary queue sets in MSG_QS_CFG Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki Signed-off-by: Jerin Jacob --- drivers/net/thunderx/base/nicvf_hw_defs.h | 1 + drivers/net/thunderx/base/nicvf_mbox.c | 34 ++++++++++++++++++++++++++++++- drivers/net/thunderx/base/nicvf_mbox.h | 21 +++++++++++++++++-- drivers/net/thunderx/nicvf_struct.h | 5 +++++ 4 files changed, 58 insertions(+), 3 deletions(-) diff --git a/drivers/net/thunderx/base/nicvf_hw_defs.h b/drivers/net/thunderx/base/nicvf_hw_defs.h index 2f2b225..3b947e0 100644 --- a/drivers/net/thunderx/base/nicvf_hw_defs.h +++ b/drivers/net/thunderx/base/nicvf_hw_defs.h @@ -207,6 +207,7 @@ #define NICVF_CQE_RX2_RBPTR_WORD (7) #define NICVF_STATIC_ASSERT(s) _Static_assert(s, #s) +#define assert_if_secondary(nic) assert((nic)->sqs_mode == 0) typedef uint64_t nicvf_phys_addr_t; diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c index 9c5cd83..974ce97 100644 --- a/drivers/net/thunderx/base/nicvf_mbox.c +++ b/drivers/net/thunderx/base/nicvf_mbox.c @@ -62,6 +62,9 @@ static const char *mbox_message[NIC_MBOX_MSG_MAX] = { [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)) @@ -173,7 +176,7 @@ nicvf_handle_mbx_intr(struct nicvf *nic) 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; @@ -183,6 +186,13 @@ nicvf_handle_mbx_intr(struct nicvf *nic) nic->speed = mbx.link_status.speed; nic->pf_acked = true; break; + case NIC_MBOX_MSG_ALLOC_SQS_RES_BIT: + assert_if_secondary(nic); + assert(mbx.sqs_alloc.qs_count == nic->sqs_count); + for (i = 0; i < mbx.sqs_alloc.qs_count; i++) + assert(mbx.sqs_alloc.svf[i] == nic->snicvf[i]->vf_id); + 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)); @@ -314,11 +324,33 @@ nicvf_mbox_qset_config(struct nicvf *nic, struct pf_qs_cfg *qs_cfg) /* 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_if_secondary(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) { struct nic_mbx mbx = { .msg = { 0 } }; diff --git a/drivers/net/thunderx/base/nicvf_mbox.h b/drivers/net/thunderx/base/nicvf_mbox.h index 7c0c6a9..084f3a7 100644 --- a/drivers/net/thunderx/base/nicvf_mbox.h +++ b/drivers/net/thunderx/base/nicvf_mbox.h @@ -36,6 +36,7 @@ #include #include "nicvf_plat.h" +#include "../nicvf_struct.h" /* PF <--> VF Mailbox communication * Two 64bit registers are shared between PF and VF for each VF @@ -67,10 +68,16 @@ #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; @@ -155,6 +162,14 @@ struct bgx_link_status { 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; @@ -201,6 +216,7 @@ union { 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; }; @@ -211,6 +227,7 @@ NICVF_STATIC_ASSERT(sizeof(struct nic_mbx) <= 16); 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); diff --git a/drivers/net/thunderx/nicvf_struct.h b/drivers/net/thunderx/nicvf_struct.h index c52545d..a72f752 100644 --- a/drivers/net/thunderx/nicvf_struct.h +++ b/drivers/net/thunderx/nicvf_struct.h @@ -119,6 +119,11 @@ struct nicvf { uint16_t mtu; bool vlan_filter_en; uint8_t mac_addr[ETHER_ADDR_LEN]; + /* secondary queue set support */ + uint8_t sqs_id; + uint8_t sqs_count; +#define MAX_SQS_PER_VF 11 + struct nicvf *snicvf[MAX_SQS_PER_VF]; } __rte_cache_aligned; #endif /* _THUNDERX_NICVF_STRUCT_H */ -- 1.9.1