From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <3chas3@gmail.com> Received: from mail-qk0-f182.google.com (mail-qk0-f182.google.com [209.85.220.182]) by dpdk.org (Postfix) with ESMTP id 446C88E8F for ; Thu, 31 Dec 2015 01:38:01 +0100 (CET) Received: by mail-qk0-f182.google.com with SMTP id n135so98691744qka.2 for ; Wed, 30 Dec 2015 16:38:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7jTzgyD9ylh2MvR5AFsSagJRBJLJctyIT4vGZiqDFug=; b=RwHCBxcCNAZg77rU7AtOoyX5uXHl/KwRjEbSmcAEhvi6WvrPBuKI2Olfq+gFDdIDys r2Un4DMM+oRP8u8RoXLKMVakvgOhDf7roeXC+6i5Ti/hPNjpnTZpdjQAk9nQoyqvO5C0 5Pypd24TMrxVQLqUUdxhrd7fclLgwHjZ+AgawO7ohtEA7LoyJOWzzBnZmeUdw9f0KWrz 1hVHJU7E0B/B9Udsavf1YeVwsEU0lVWGnuQiB8FMsasHRZzvpRI5KPbRxzG8RAkQbqsz 0WbAnY82tOh+coUKvneLy22cU9ipnTyewChPfZ01MA6T9AOxOj969+qfw39HgnfW7onS lxcg== X-Received: by 10.55.78.70 with SMTP id c67mr87771093qkb.37.1451522280859; Wed, 30 Dec 2015 16:38:00 -0800 (PST) Received: from monolith.home (pool-173-66-34-64.washdc.fios.verizon.net. [173.66.34.64]) by smtp.gmail.com with ESMTPSA id f1sm26166674qkh.21.2015.12.30.16.38.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Dec 2015 16:38:00 -0800 (PST) From: Chas Williams <3chas3@gmail.com> To: dev@dpdk.org Date: Wed, 30 Dec 2015 19:37:51 -0500 Message-Id: <1451522271-16924-2-git-send-email-3chas3@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1451522271-16924-1-git-send-email-3chas3@gmail.com> References: <1451522271-16924-1-git-send-email-3chas3@gmail.com> Cc: "Charles \(Chas\) Williams" Subject: [dpdk-dev] [PATCH 2/2] bnx2x: Determine rx/tx queue sizes sooner 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: Thu, 31 Dec 2015 00:38:01 -0000 From: "Charles (Chas) Williams" The VF needs to determine the queues sizes before .dev_infos_get so that it can hint to the upper layer the proper sizes. Move bnx2x_vf_get_resources() to .eth_dev_init and probe with the guesses from bnx2x_init_rte(). Signed-off-by: Chas Williams <3chas3@gmail.com> --- drivers/net/bnx2x/bnx2x.c | 9 ++++++-- drivers/net/bnx2x/bnx2x_ethdev.c | 46 ++++++++++++++++++++++------------------ drivers/net/bnx2x/bnx2x_vfpf.c | 2 ++ 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 67af5da..f003875 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -9578,8 +9578,13 @@ static int bnx2x_pci_get_caps(struct bnx2x_softc *sc) static void bnx2x_init_rte(struct bnx2x_softc *sc) { - sc->max_tx_queues = 128; - sc->max_rx_queues = 128; + if (IS_VF(sc)) { + sc->max_tx_queues = BNX2X_VF_MAX_QUEUES_PER_VF; + sc->max_rx_queues = BNX2X_VF_MAX_QUEUES_PER_VF; + } else { + sc->max_tx_queues = 128; + sc->max_rx_queues = 128; + } } #define FW_HEADER_LEN 104 diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 69df02e..fe8cfd0 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -87,7 +87,6 @@ bnx2x_dev_configure(struct rte_eth_dev *dev) { struct bnx2x_softc *sc = dev->data->dev_private; int mp_ncpus = sysconf(_SC_NPROCESSORS_CONF); - int ret; PMD_INIT_FUNC_TRACE(); @@ -121,25 +120,6 @@ bnx2x_dev_configure(struct rte_eth_dev *dev) return -ENXIO; } - if (IS_VF(sc)) { - if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg), - &sc->vf2pf_mbox_mapping, "vf2pf_mbox", - RTE_CACHE_LINE_SIZE) != 0) - return -ENOMEM; - - sc->vf2pf_mbox = (struct bnx2x_vf_mbx_msg *)sc->vf2pf_mbox_mapping.vaddr; - if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_bulletin), - &sc->pf2vf_bulletin_mapping, "vf2pf_bull", - RTE_CACHE_LINE_SIZE) != 0) - return -ENOMEM; - - sc->pf2vf_bulletin = (struct bnx2x_vf_bulletin *)sc->pf2vf_bulletin_mapping.vaddr; - - ret = bnx2x_vf_get_resources(sc, sc->num_queues, sc->num_queues); - if (ret) - return ret; - } - return 0; } @@ -466,6 +446,7 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) ret = bnx2x_attach(sc); if (ret) { PMD_DRV_LOG(ERR, "bnx2x_attach failed (%d)", ret); + return ret; } eth_dev->data->mac_addrs = (struct ether_addr *)sc->link_params.mac_addr; @@ -479,7 +460,30 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) PMD_DRV_LOG(INFO, "portID=%d vendorID=0x%x deviceID=0x%x", eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); - return ret; + if (IS_VF(sc)) { + if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_mbx_msg), + &sc->vf2pf_mbox_mapping, "vf2pf_mbox", + RTE_CACHE_LINE_SIZE) != 0) + return -ENOMEM; + + sc->vf2pf_mbox = (struct bnx2x_vf_mbx_msg *) + sc->vf2pf_mbox_mapping.vaddr; + + if (bnx2x_dma_alloc(sc, sizeof(struct bnx2x_vf_bulletin), + &sc->pf2vf_bulletin_mapping, "vf2pf_bull", + RTE_CACHE_LINE_SIZE) != 0) + return -ENOMEM; + + sc->pf2vf_bulletin = (struct bnx2x_vf_bulletin *) + sc->pf2vf_bulletin_mapping.vaddr; + + ret = bnx2x_vf_get_resources(sc, sc->max_tx_queues, + sc->max_rx_queues); + if (ret) + return ret; + } + + return 0; } static int diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index 34b6360..bce734f 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -282,6 +282,8 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ sc->igu_sb_cnt = sc_resp.resc.num_sbs; sc->igu_base_sb = sc_resp.resc.hw_sbs[0] & 0xFF; sc->igu_dsb_id = -1; + sc->max_tx_queues = sc_resp.resc.num_txqs; + sc->max_rx_queues = sc_resp.resc.num_rxqs; sc->link_params.chip_id = sc->devinfo.chip_id; sc->doorbell_size = sc_resp.db_size; -- 2.5.0