From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0064.outbound.protection.outlook.com [104.47.40.64]) by dpdk.org (Postfix) with ESMTP id 311871C0B; Wed, 23 May 2018 01:16:16 +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:X-MS-Exchange-SenderADCheck; bh=KdbR2nQ8pf+Lvbf1pXs2CnxY1YdzvLXZw69+rRaf4nc=; b=CIuucWriYs3QXI+oa3NtzJc8vaJrosUGvdXUGk4+qI95wwj5ot7bzBYxTGFicYia5q5JUm4JefTrD1yU1xV4VUNafbpSlc+PZout82PmatviqxkPP+SU8+Cb4AipOgOw1ke2oo7A8r+Z89wncEFV5DzD5Jswz/xzeVlLKkLmGw8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Rasesh.Mody@cavium.com; Received: from cavium.com (198.186.0.2) by DM5PR0701MB3671.namprd07.prod.outlook.com (2603:10b6:4:7e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 23:16:13 +0000 From: Rasesh Mody To: dev@dpdk.org Cc: Rasesh Mody , ferruh.yigit@intel.com, Dept-EngDPDKDev@cavium.com, stable@dpdk.org Date: Tue, 22 May 2018 16:16:03 -0700 Message-Id: <1527030964-17525-1-git-send-email-rasesh.mody@cavium.com> X-Mailer: git-send-email 1.7.10.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [198.186.0.2] X-ClientProxiedBy: CO2PR04CA0065.namprd04.prod.outlook.com (2603:10b6:102:1::33) To DM5PR0701MB3671.namprd07.prod.outlook.com (2603:10b6:4:7e::19) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DM5PR0701MB3671; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3671; 3:eGcSI4X/+xnYMqynde/tLc1l0/pt7z2PCE6L3ZrZTE49T5W04Ug73UHIQm1X9D310eac6LmEYvle6FY+4tB+7PuUQ933roipfHAl1ZdnwTIW9GB1pRIfkE2sn0jGslobQKwK9lzsreukwzgneh2UN6bi1K8eK0t1g627uVI7a/P/8k7IxPOHkUs/NrR+vZl8G+13eqVrnbPJPr6XKYKAcctz0RG901pq1PWGoscpYuG11bdryQaEWsu9Q3M5OCIo; 25:fjH/bKxnlMCD4UQVbYD2Fip/dwj1Y/7LUf32qozLPcr8LVO+wFIUyF1vEus49YJ2GJRz5l29yzdwIXSOGa/MPRvsFVYDRgpf7ZrJmhc0erDawBlrcnNUh6Cu22SewPp2ZX5WVRDJLVvm4tmAltIlcqOZCjRKfBBKl9g111lErugWKStbjF1Sl8lL4WilfFXeDYruOjcBBGIDPQOWIi9BeSBHri0u2UA88jo/x1Sas3d4A/Ei/P1xrSEdwfeTM9oM06EgcQF5kHJ8vTbl2x+/5K31zPjt5T/DmcBlRsfLXDlt58YGG9UzLRCqu1P97La0WXtkHFXHR+gp1upDJvHXVQ==; 31:6eAnBqYKbYNW/5tkrLGLhA/a5z6Hz1AGytJFsHcC+YygElXhlJVOFsyP7QWYyDSMrXoJJPLFqQ9UUDn+7H+zDot1VircduruOrCYKn4Q7GGCr3ptYOUHiPc/Ifdq5xBhHkRJykUGONK0LGIY+EWF0L0dwgFaF/bREHN5Z726M6Ev2WztKPW2svfJNFwDe2FFQ5Q9funZCYwaN6q1B670hWA84ISb7Tc0Rj7dzMiV5LM= X-MS-TrafficTypeDiagnostic: DM5PR0701MB3671: X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3671; 20:UygWHiDQQYUTB0ikZHgKwo3WkzAFDOmuc3sEB0hj3cUiufokI6fxWedAP8c9Xc6OUI2wEh8f+kgfSnQ2QbyYDrE/mUgqZ0p3Cqkn9H6ZzVqOR7jcIl5z3sm9n7kwE2GaH7YuPAEjbiFSM5wdTWjaYuUHD82QlutkbodBLyJvZRcN9BE+GaJOUpXw1BQWuqWVD3BwBt3A5w+Cx3i3KpISE5bIad8R2bO8cqHVKe0fzTa0nHn/V8F60HXt7rw5KWHaHIeMf70o3/b2Ku2YouIZxUT4smg+xw0xmI+a8y9+svveWZ8/g1PakGsGpJTk2n1vb7GaqjNLQxANTYmYm0RKWV8geYAxjw+XKTHK4gyXqaUiAA12PTz2VCAI5IkThezjwDxhwDxlizZkZmXXPz+U6qI/Js2jDpwzMYI5ZLWPaGKtlMAgMClzNL9B4jtUsydeoFwCQBU28Sb1rYCfdbLzDUUP0NCZO9zp3mINXk/wbiDhDuvLrvCSvwGs1arpypSI; 4:BXV099h++QfP/Pmtl9RJ5Zf9A0h3H6qBDBpUpZzyH/8IpRScqvxnlimvkS7O54+eVItg6VAoD0epGlnLIDHRExUwGsPu1suRLw3LgBA7IryP/pgPhixUOzqeN0NETp+yT+7+42cgVtwodwXrI772oP+lj/0n2sRRNOh7M+NlkU30DxCshVRbAQWUj2LVfkUNJJAsL7ISx3HV1UDITONzhLczYOHBUyJpRrhEGIGpExv32A2hJTtJhj7ijA2215M4YjpYfRlpMNWZ7HXlJNBjYg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DM5PR0701MB3671; BCL:0; PCL:0; RULEID:; SRVR:DM5PR0701MB3671; X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(396003)(39380400002)(39860400002)(346002)(199004)(189003)(106356001)(55016002)(3846002)(956004)(476003)(2616005)(105586002)(50466002)(2906002)(53936002)(48376002)(21086003)(7736002)(16526019)(59450400001)(6116002)(386003)(305945005)(26005)(186003)(36756003)(2351001)(69596002)(15650500001)(66066001)(478600001)(316002)(8936002)(81156014)(44832011)(6666003)(4326008)(6916009)(68736007)(2361001)(7696005)(25786009)(52116002)(50226002)(8676002)(86362001)(97736004)(72206003)(16586007)(47776003)(5660300001)(51416003)(81166006)(4720700003)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR0701MB3671; H:cavium.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR0701MB3671; 23:DR2tnPFhAhstDHwMIqZb5rve9vMgPqFwRrx3t/N?= =?us-ascii?Q?fV8TzLeBC7TOqk5Z3owwYCGvC9PQhMBs3O6C4hlkzO6tefXPIB7waCK8FPgw?= =?us-ascii?Q?G267s/VBmhwVKZhQrP5yBJbZBzPW3qMvdknmTdRk2WnnmV1tOe6a7G+5pwsX?= =?us-ascii?Q?u/8Runur6KMHfBskkJ8kLCO1TORgyIBiML9IFj3Oz4r2LutNZq7XwU07ncX7?= =?us-ascii?Q?aham19pKaVGnccZPIyLVC3ooiIrefXvrUn1P/cQtkrysgAYilrhXijObsp1g?= =?us-ascii?Q?UCxPBedWAdnz3sM8z23lAM5PYQsss234X3CAq25ZfVDovLt5dpQqRfTcfpNI?= =?us-ascii?Q?qaZpGHUspMc5Q2UChxXUQDoa/dTKo4/UVXW10TbTRRnQEh6h+73MOqUNGSa0?= =?us-ascii?Q?OXFllwFBEIaUj1TpJQek7coBSE9HkT2Oodh0TPXUGqzqVQ7kinN4JldPRwIL?= =?us-ascii?Q?bgEqq5Iv0NP1e2667w97Wnik3vwxfzWWgp6sb5ECUu4U5DL501dr6a+CWQ5U?= =?us-ascii?Q?ZcvGmitrB3tXdCv6+kjOa5jOCLLssvGwcDwJRJ1LmMkoE0ZySRu2hEMD6RpY?= =?us-ascii?Q?VNQz3c2d+6P6QIRxHf8ixV/ThWVvMljMednOWaa4LgJ7UYt/vVHlEuyWa4i+?= =?us-ascii?Q?LBd0EMbCY39XifWaFOQSrS0zPrMAvSCn5l7RyNPfKhih74ts09Lyr3/FLcaY?= =?us-ascii?Q?GKPq1h3Wj0TQ+il94ZLWvKylDTme0E34fIJd6OkPQZvaExNNyUU1+yIAsH87?= =?us-ascii?Q?sr3Bq/LbFk95ucTUJZjJ+b5n41h2vccRBI2pzQGwl/2Wy/Q4XKh1zMK97xcl?= =?us-ascii?Q?VW3hCnESGcxoRA34z2X3bOkqOL4cztQXJPYm0JJTLhHvPF7DDY+i3f90hEkp?= =?us-ascii?Q?kjaAi4Z+Ijz+118DtkO9670mrOovJ9DXt07nMQJpps6T2/FE5kDTJsSSsn3r?= =?us-ascii?Q?IM9j44M3Mzbze4BFGXQJ7+UWu3v+TzvV298lenFjaJtMsNIgW3bAuo98E5IP?= =?us-ascii?Q?/minXBOZsPn6oKh8sdOs676TAoBB+CSXAs2zjExkGs3ka+0mGkey+UbZs6jB?= =?us-ascii?Q?BBuk7CRuCOhZ1NwNQ8XHbpUBis0rf77TvOw2hFD4O0Cfhi+LWpLINVdr0/A6?= =?us-ascii?Q?2dFfX+JoRLrwG1DtaVPMVzAsGQLF6uqq+xrKHFqMr7u5gmB3w9Daqw3WFJjm?= =?us-ascii?Q?p+pUUV3e4dnfyfFzoHjbhj8qyyAnNtn4CZw3TBYf3FSeVdFMt4xcy4zlT3yy?= =?us-ascii?Q?MIfvXdbKD6uLYTbB+xqJHH5p7qWwmtDj3myFMcaVlxwjVTtTimXopECS9KLf?= =?us-ascii?Q?c1O6imaKfWVej9QTAMGQRthU=3D?= X-Microsoft-Antispam-Message-Info: kjtt2trPF81U+kX1xMi47/69ncsrmpjBC9N9bvObfWkLKggYcjFNSMJa9xmyxihpoLJWq8iv9Y9Qg58SywHZjG2gyuPEZ1C/EIhU0N6z7L4d6JN4kxb/BGYKsjHod6UP+WhAzw1aKkpj0d4u3M69IvgTvfmHoNI+w8k9pH3MLDubDqV59OzNQlgGBLmnxRUO X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3671; 6:+JmBOtVhBrfyxk1JSM4kwSuZRI2QmbYQvPfNWqoJc/RPfikCnsfKbQY4H+4s7aJfe4NLASHcU6a2vwLuYrN94Oiul51yOM+Kyo+vbcggC/1c180cdfduWrrZzHcn79rS6Hp6d6qS2oLn83HGA91aefu2iBbEiCiMJMKGiSw2pmouTEORTEZZ0HZC8cESkpfQHLvXRJ8VXi+D5G/ZII8O6/xlWusXG6AdLX5ra0fxUKndH+JS9g8x6dp5yv1OpfP9k3W+3DKBxaQBpvq1dWXNAD5pXeCdf8TAxyI0bJDIhGQqO7pnpDkxLOWZ4z1TQ8KfEUsNxOVKRbsrPYtiooUF9p2tzAvYVM3rf5uQ3aDjaoFAWzXDoq0D897Ob0TJN4AQNyTa4d5Tt/Dpdm951pMQRBDB/wBSujXnZPi7T2Jdg1IQ5TKz3T/BPCTHEjeN8OttANWMxUxU/779TBzHcexTnw==; 5:IyecFZsuZIZywF0kU6yeA/71+BQnHROW+RAs/CezZyFIIb9pCzFwK0ap7TOoJXsOICTZ8vl7lDbMOaAjVaRRC4IrgVKSYgtlxJ44LPJBZ9+KclfyPUYGSytnaosGGfS+UfSt9++FpwOd7VDEHQfX6bqDyNs73bmTzae3DpfWqyY=; 24:pVHUquFFuYZbybcyiBc5Gom1rnqPGJglh1cNNC4ptknNY4mq10sizPVlyz5USLD+OZzSg2J3Hj+J+GsSysOZYg6+IS7RN96D7yIrtAhiojQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3671; 7:PPkni2SVNX0Oq7ptkIkqiOHFdBI9R5KWDbFUnezWUQQjC3sCQqenzGB7pTbkKdNxqjva4BVwkDtiWg/uxNEA+2x0eXi+E3NnfKuNk2onWKPZ88/XbkWM/31AxXkT9bTAZ4TEgbEvhaBZ5+kzAqoUzsrN4TBB4tPophic+Agp5cJ68+pKBkndfSqRHU+ML0jNyHjY9C6IiiWoyMX0z4j9IQcTFG27VBy3nJJkuTkkwN7GVdCF327LcSEu6JZjldVL X-MS-Office365-Filtering-Correlation-Id: 00e0ede9-2bc2-4050-1465-08d5c03a035a X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 23:16:13.4508 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00e0ede9-2bc2-4050-1465-08d5c03a035a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR0701MB3671 Subject: [dpdk-dev] [PATCH 1/2] net/qede: fix to update VF MTU X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 23:16:17 -0000 This patch fixes VF MTU update to work without having to restart the vport and there by not requiring port re-configuration. It adds a VF MTU Update TLV to achieve the same. Firmware can handle VF MTU update by just pausing the vport. Fixes: dd28bc8c6ef4 ("net/qede: fix VF port creation sequence") Cc: stable@dpdk.org Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore_sriov.c | 44 ++++++++++++ drivers/net/qede/base/ecore_vf.c | 33 +++++++++ drivers/net/qede/base/ecore_vf.h | 9 +++ drivers/net/qede/base/ecore_vfpf_if.h | 16 +++++ drivers/net/qede/qede_ethdev.c | 120 ++++++++++++++++++++------------- drivers/net/qede/qede_ethdev.h | 1 + 6 files changed, 175 insertions(+), 48 deletions(-) diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c index 93674a2..758b6e8 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -61,6 +61,8 @@ static enum _ecore_status_t ecore_sriov_eqe_event(struct ecore_hwfn *p_hwfn, "CHANNEL_TLV_COALESCE_UPDATE", "CHANNEL_TLV_QID", "CHANNEL_TLV_COALESCE_READ", + "CHANNEL_TLV_BULLETIN_UPDATE_MAC", + "CHANNEL_TLV_UPDATE_MTU", "CHANNEL_TLV_MAX" }; @@ -2858,6 +2860,45 @@ static void ecore_iov_vf_mbx_update_rxqs(struct ecore_hwfn *p_hwfn, length, status); } +static enum _ecore_status_t +ecore_iov_vf_pf_update_mtu(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + struct ecore_vf_info *p_vf) +{ + struct ecore_iov_vf_mbx *mbx = &p_vf->vf_mbx; + struct ecore_sp_vport_update_params params; + enum _ecore_status_t rc = ECORE_SUCCESS; + struct vfpf_update_mtu_tlv *p_req; + u8 status = PFVF_STATUS_SUCCESS; + + /* Valiate PF can send such a request */ + if (!p_vf->vport_instance) { + DP_VERBOSE(p_hwfn, ECORE_MSG_IOV, + "No VPORT instance available for VF[%d], failing MTU update\n", + p_vf->abs_vf_id); + status = PFVF_STATUS_FAILURE; + goto send_status; + } + + p_req = &mbx->req_virt->update_mtu; + + OSAL_MEMSET(¶ms, 0, sizeof(params)); + params.opaque_fid = p_vf->opaque_fid; + params.vport_id = p_vf->vport_id; + params.mtu = p_req->mtu; + rc = ecore_sp_vport_update(p_hwfn, ¶ms, ECORE_SPQ_MODE_EBLOCK, + OSAL_NULL); + + if (rc) + status = PFVF_STATUS_FAILURE; +send_status: + ecore_iov_prepare_resp(p_hwfn, p_ptt, p_vf, + CHANNEL_TLV_UPDATE_MTU, + sizeof(struct pfvf_def_resp_tlv), + status); + return rc; +} + void *ecore_iov_search_list_tlvs(struct ecore_hwfn *p_hwfn, void *p_tlvs_list, u16 req_type) { @@ -4140,6 +4181,9 @@ void ecore_iov_process_mbx_req(struct ecore_hwfn *p_hwfn, case CHANNEL_TLV_COALESCE_READ: ecore_iov_vf_pf_get_coalesce(p_hwfn, p_ptt, p_vf); break; + case CHANNEL_TLV_UPDATE_MTU: + ecore_iov_vf_pf_update_mtu(p_hwfn, p_ptt, p_vf); + break; } } else if (ecore_iov_tlv_supported(mbx->first_tlv.tl.type)) { /* If we've received a message from a VF we consider malicious diff --git a/drivers/net/qede/base/ecore_vf.c b/drivers/net/qede/base/ecore_vf.c index 8a08911..334db6b 100644 --- a/drivers/net/qede/base/ecore_vf.c +++ b/drivers/net/qede/base/ecore_vf.c @@ -1628,6 +1628,39 @@ enum _ecore_status_t return rc; } +enum _ecore_status_t +ecore_vf_pf_update_mtu(struct ecore_hwfn *p_hwfn, u16 mtu) +{ + struct ecore_vf_iov *p_iov = p_hwfn->vf_iov_info; + struct vfpf_update_mtu_tlv *p_req; + struct pfvf_def_resp_tlv *p_resp; + enum _ecore_status_t rc; + + if (!mtu) + return ECORE_INVAL; + + /* clear mailbox and prep header tlv */ + p_req = ecore_vf_pf_prep(p_hwfn, CHANNEL_TLV_UPDATE_MTU, + sizeof(*p_req)); + p_req->mtu = mtu; + DP_VERBOSE(p_hwfn, ECORE_MSG_IOV, + "Requesting MTU update to %d\n", mtu); + + /* add list termination tlv */ + ecore_add_tlv(&p_iov->offset, + CHANNEL_TLV_LIST_END, + sizeof(struct channel_list_end_tlv)); + + p_resp = &p_iov->pf2vf_reply->default_resp; + rc = ecore_send_msg2pf(p_hwfn, &p_resp->hdr.status, sizeof(*p_resp)); + if (p_resp->hdr.status == PFVF_STATUS_NOT_SUPPORTED) + rc = ECORE_INVAL; + + ecore_vf_pf_req_end(p_hwfn, rc); + + return rc; +} + u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn, u16 sb_id) { diff --git a/drivers/net/qede/base/ecore_vf.h b/drivers/net/qede/base/ecore_vf.h index de2758c..e5555bb 100644 --- a/drivers/net/qede/base/ecore_vf.h +++ b/drivers/net/qede/base/ecore_vf.h @@ -319,5 +319,14 @@ enum _ecore_status_t u32 ecore_vf_hw_bar_size(struct ecore_hwfn *p_hwfn, enum BAR_ID bar_id); + +/** + * @brief - ecore_vf_pf_update_mtu Update MTU for VF. + * + * @param p_hwfn + * @param - mtu + */ +enum _ecore_status_t +ecore_vf_pf_update_mtu(struct ecore_hwfn *p_hwfn, u16 mtu); #endif #endif /* __ECORE_VF_H__ */ diff --git a/drivers/net/qede/base/ecore_vfpf_if.h b/drivers/net/qede/base/ecore_vfpf_if.h index c6af9ca..08b1f24 100644 --- a/drivers/net/qede/base/ecore_vfpf_if.h +++ b/drivers/net/qede/base/ecore_vfpf_if.h @@ -531,6 +531,18 @@ struct pfvf_read_coal_resp_tlv { u8 padding[6]; }; +struct vfpf_bulletin_update_mac_tlv { + struct vfpf_first_tlv first_tlv; + u8 mac[ETH_ALEN]; + u8 padding[2]; +}; + +struct vfpf_update_mtu_tlv { + struct vfpf_first_tlv first_tlv; + u16 mtu; + u8 padding[6]; +}; + union vfpf_tlvs { struct vfpf_first_tlv first_tlv; struct vfpf_acquire_tlv acquire; @@ -545,6 +557,8 @@ struct pfvf_read_coal_resp_tlv { struct vfpf_update_tunn_param_tlv tunn_param_update; struct vfpf_update_coalesce update_coalesce; struct vfpf_read_coal_req_tlv read_coal_req; + struct vfpf_bulletin_update_mac_tlv bulletin_update_mac; + struct vfpf_update_mtu_tlv update_mtu; struct tlv_buffer_size tlv_buf_size; }; @@ -675,6 +689,8 @@ enum { CHANNEL_TLV_COALESCE_UPDATE, CHANNEL_TLV_QID, CHANNEL_TLV_COALESCE_READ, + CHANNEL_TLV_BULLETIN_UPDATE_MAC, + CHANNEL_TLV_UPDATE_MTU, CHANNEL_TLV_MAX, /* Required for iterating over vport-update tlvs. diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 30b6519..8c320c6 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -603,37 +603,6 @@ int qede_enable_tpa(struct rte_eth_dev *eth_dev, bool flg) return 0; } -/* Update MTU via vport-update without doing port restart. - * The vport must be deactivated before calling this API. - */ -int qede_update_mtu(struct rte_eth_dev *eth_dev, uint16_t mtu) -{ - struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); - struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); - struct ecore_sp_vport_update_params params; - struct ecore_hwfn *p_hwfn; - int rc; - int i; - - memset(¶ms, 0, sizeof(struct ecore_sp_vport_update_params)); - params.vport_id = 0; - params.mtu = mtu; - params.vport_id = 0; - for_each_hwfn(edev, i) { - p_hwfn = &edev->hwfns[i]; - params.opaque_fid = p_hwfn->hw_info.opaque_fid; - rc = ecore_sp_vport_update(p_hwfn, ¶ms, - ECORE_SPQ_MODE_EBLOCK, NULL); - if (rc != ECORE_SUCCESS) { - DP_ERR(edev, "Failed to update MTU\n"); - return -1; - } - } - DP_INFO(edev, "MTU updated to %u\n", mtu); - - return 0; -} - static void qede_set_ucast_cmn_params(struct ecore_filter_ucast *ucast) { memset(ucast, 0, sizeof(struct ecore_filter_ucast)); @@ -1296,6 +1265,12 @@ static int qede_dev_start(struct rte_eth_dev *eth_dev) PMD_INIT_FUNC_TRACE(edev); + /* Update MTU only if it has changed */ + if (eth_dev->data->mtu != qdev->mtu) { + if (qede_update_mtu(eth_dev, qdev->mtu)) + goto err; + } + /* Configure TPA parameters */ if (rxmode->offloads & DEV_RX_OFFLOAD_TCP_LRO) { if (qede_enable_tpa(eth_dev, true)) @@ -2056,6 +2031,72 @@ static void qede_allmulticast_disable(struct rte_eth_dev *eth_dev) return qede_add_mcast_filters(eth_dev, mc_addrs, mc_addrs_num); } +/* Update MTU via vport-update without doing port restart. + * The vport must be deactivated before calling this API. + */ +int qede_update_mtu(struct rte_eth_dev *eth_dev, uint16_t mtu) +{ + struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); + struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); + struct ecore_hwfn *p_hwfn; + int rc; + int i; + + if (IS_PF(edev)) { + struct ecore_sp_vport_update_params params; + + memset(¶ms, 0, sizeof(struct ecore_sp_vport_update_params)); + params.vport_id = 0; + params.mtu = mtu; + params.vport_id = 0; + for_each_hwfn(edev, i) { + p_hwfn = &edev->hwfns[i]; + params.opaque_fid = p_hwfn->hw_info.opaque_fid; + rc = ecore_sp_vport_update(p_hwfn, ¶ms, + ECORE_SPQ_MODE_EBLOCK, NULL); + if (rc != ECORE_SUCCESS) + goto err; + } + } else { + for_each_hwfn(edev, i) { + p_hwfn = &edev->hwfns[i]; + rc = ecore_vf_pf_update_mtu(p_hwfn, mtu); + if (rc == ECORE_INVAL) { + DP_INFO(edev, "VF MTU Update TLV not supported\n"); + /* Recreate vport */ + rc = qede_start_vport(qdev, mtu); + if (rc != ECORE_SUCCESS) + goto err; + + /* Restore config lost due to vport stop */ + qede_mac_addr_set(eth_dev, &qdev->primary_mac); + + if (eth_dev->data->promiscuous) + qede_promiscuous_enable(eth_dev); + else + qede_promiscuous_disable(eth_dev); + + if (eth_dev->data->all_multicast) + qede_allmulticast_enable(eth_dev); + else + qede_allmulticast_disable(eth_dev); + + qede_vlan_offload_set(eth_dev, + qdev->vlan_offload_mask); + } else if (rc != ECORE_SUCCESS) { + goto err; + } + } + } + DP_INFO(edev, "%s MTU updated to %u\n", IS_PF(edev) ? "PF" : "VF", mtu); + + return 0; + +err: + DP_ERR(edev, "Failed to update MTU\n"); + return -1; +} + static int qede_flow_ctrl_set(struct rte_eth_dev *eth_dev, struct rte_eth_fc_conf *fc_conf) { @@ -2463,7 +2504,6 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) qede_mac_addr_remove(dev, 0); } rte_delay_ms(1000); - qede_start_vport(qdev, mtu); /* Recreate vport */ qdev->mtu = mtu; /* Fix up RX buf size for all queues of the port */ @@ -2487,22 +2527,6 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) else dev->data->dev_conf.rxmode.jumbo_frame = 0; - /* Restore config lost due to vport stop */ - if (IS_PF(edev)) - qede_mac_addr_set(dev, &qdev->primary_mac); - - if (dev->data->promiscuous) - qede_promiscuous_enable(dev); - else - qede_promiscuous_disable(dev); - - if (dev->data->all_multicast) - qede_allmulticast_enable(dev); - else - qede_allmulticast_disable(dev); - - qede_vlan_offload_set(dev, qdev->vlan_offload_mask); - if (!dev->data->dev_started && restart) { qede_dev_start(dev); dev->data->dev_started = 1; diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index 4737c8f..b7df315 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -34,6 +34,7 @@ #include "base/nvm_cfg.h" #include "base/ecore_sp_commands.h" #include "base/ecore_l2.h" +#include "base/ecore_vf.h" #include "qede_logs.h" #include "qede_if.h" -- 1.7.10.3