From patchwork Mon May 18 15:28:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shradha Shah X-Patchwork-Id: 473420 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D0E911401B5 for ; Tue, 19 May 2015 01:28:30 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753976AbbERP21 (ORCPT ); Mon, 18 May 2015 11:28:27 -0400 Received: from nbfkord-smmo04.seg.att.com ([209.65.160.86]:45494 "EHLO nbfkord-smmo04.seg.att.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752762AbbERP2Z (ORCPT ); Mon, 18 May 2015 11:28:25 -0400 Received: from unknown [12.187.104.25] (EHLO webmail.solarflare.com) by nbfkord-smmo04.seg.att.com(mxl_mta-7.2.4-5) with ESMTP id 9150a555.2ad11d461940.1958292.00-2456.10694620.nbfkord-smmo04.seg.att.com (envelope-from ); Mon, 18 May 2015 15:28:25 +0000 (UTC) X-MXL-Hash: 555a051926f85fcb-f94f317747827856268e591a80a5fcac311c02f3 Received: from unknown [12.187.104.25] (EHLO webmail.solarflare.com) by nbfkord-smmo04.seg.att.com(mxl_mta-7.2.4-5) over TLS secured channel with ESMTP id 6150a555.0.1958283.00-2027.10694582.nbfkord-smmo04.seg.att.com (envelope-from ); Mon, 18 May 2015 15:28:24 +0000 (UTC) X-MXL-Hash: 555a05185ff27997-710c3ddfbc2a4643cc776b61d1b783efe39fc483 Received: from sshah-desktop.uk.level5networks.com (10.17.20.135) by webmail.SolarFlare.com (10.20.40.31) with Microsoft SMTP Server (TLS) id 14.3.158.1; Mon, 18 May 2015 08:28:21 -0700 Message-ID: <555A0513.4060702@solarflare.com> Date: Mon, 18 May 2015 16:28:19 +0100 From: Shradha Shah User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: David Miller CC: , Subject: [PATCH net-next 04/16] sfc: Store vf_index in nic_data for Ef10. References: <555A044A.4060202@solarflare.com> In-Reply-To: <555A044A.4060202@solarflare.com> X-Originating-IP: [10.17.20.135] X-TM-AS-Product-Ver: SMEX-10.0.0.1412-7.000.1014-21552.005 X-TM-AS-Result: No--6.195000-0.000000-31 X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-AnalysisOut: [v=2.0 cv=I4vSsqcg c=1 sm=1 a=MkjXnYnS3dyNWGSWLXxFFQ==:17 a] X-AnalysisOut: [=5ZTteq0x3j8A:10 a=3VnyBeAh6Z0A:10 a=BLceEmwcHowA:10 a=N65] X-AnalysisOut: [9UExz7-8A:10 a=zRKbQ67AAAAA:8 a=h1PgugrvaO0A:10 a=vlI0fJuk] X-AnalysisOut: [RSpJUP7oSXsA:9 a=pILNOxqGKmIA:10] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2014051901)] X-MAIL-FROM: X-SOURCE-IP: [12.187.104.25] Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Added function efx_ef10_get_vf_index to store the vf_index in nic_data during probe vf_index is needed in future patches to access a particular VF in the VF data structure. Moved efx_ef10_probe_pf and efx_ef10_probe_vf in order to used efx_ef10_remove Signed-off-by: Shradha Shah --- drivers/net/ethernet/sfc/ef10.c | 68 ++++++++++++++++++++++++++++++----------- drivers/net/ethernet/sfc/nic.h | 1 + 2 files changed, 52 insertions(+), 17 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 70cbad3..8b6579a 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -119,6 +119,26 @@ static int efx_ef10_get_pf_index(struct efx_nic *efx) return 0; } +#ifdef CONFIG_SFC_SRIOV +static int efx_ef10_get_vf_index(struct efx_nic *efx) +{ + MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_FUNCTION_INFO_OUT_LEN); + struct efx_ef10_nic_data *nic_data = efx->nic_data; + size_t outlen; + int rc; + + rc = efx_mcdi_rpc(efx, MC_CMD_GET_FUNCTION_INFO, NULL, 0, outbuf, + sizeof(outbuf), &outlen); + if (rc) + return rc; + if (outlen < sizeof(outbuf)) + return -EIO; + + nic_data->vf_index = MCDI_DWORD(outbuf, GET_FUNCTION_INFO_OUT_VF); + return 0; +} +#endif + static int efx_ef10_init_datapath_caps(struct efx_nic *efx) { MCDI_DECLARE_BUF(outbuf, MC_CMD_GET_CAPABILITIES_OUT_LEN); @@ -328,23 +348,6 @@ fail1: return rc; } -static int efx_ef10_probe_pf(struct efx_nic *efx) -{ - return efx_ef10_probe(efx); -} - -#ifdef CONFIG_SFC_SRIOV -static int efx_ef10_probe_vf(struct efx_nic *efx) -{ - return efx_ef10_probe(efx); -} -#else -static int efx_ef10_probe_vf(struct efx_nic *efx __attribute__ ((unused))) -{ - return 0; -} -#endif - static int efx_ef10_free_vis(struct efx_nic *efx) { MCDI_DECLARE_BUF_OUT_OR_ERR(outbuf, 0); @@ -561,6 +564,37 @@ static void efx_ef10_remove(struct efx_nic *efx) kfree(nic_data); } +static int efx_ef10_probe_pf(struct efx_nic *efx) +{ + return efx_ef10_probe(efx); +} + +#ifdef CONFIG_SFC_SRIOV +static int efx_ef10_probe_vf(struct efx_nic *efx) +{ + int rc; + + rc = efx_ef10_probe(efx); + if (rc) + return rc; + + rc = efx_ef10_get_vf_index(efx); + if (rc) + goto fail; + + return 0; + +fail: + efx_ef10_remove(efx); + return rc; +} +#else +static int efx_ef10_probe_vf(struct efx_nic *efx __attribute__ ((unused))) +{ + return 0; +} +#endif + static int efx_ef10_alloc_vis(struct efx_nic *efx, unsigned int min_vis, unsigned int max_vis) { diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h index 2fd3055..db8562e 100644 --- a/drivers/net/ethernet/sfc/nic.h +++ b/drivers/net/ethernet/sfc/nic.h @@ -525,6 +525,7 @@ struct efx_ef10_nic_data { bool must_probe_vswitching; unsigned int pf_index; #ifdef CONFIG_SFC_SRIOV + unsigned int vf_index; struct ef10_vf *vf; #endif u8 vport_mac[ETH_ALEN];