From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 5DF1FDED for ; Mon, 30 Apr 2018 16:07:50 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id j4so13409226wme.1 for ; Mon, 30 Apr 2018 07:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TENTj6VWgaRIVHNM2e23VwFEcTKOckoi/K1jiDY0kJE=; b=otA/k0+y34T+5LScfGZrWvmaH8N4vchB/JeQYYZDB8DQpu7uuaV6vdvyjOEp4Oi9fC 0GaOngKr3DFhfWjHPz47ezvGeVm+fY1GFWWbAy/5nBdat7XT63UMP9i0Ko41Vx9TJwtt Mh2VIad+Hv0OBurJP7FPShf9Jcr+VUq/Ic9o2PBKhGRbKKjezKqW1gtSQ66awhFypMo1 yoIyx2WQwiArNCYA8Si1Y690YNjAQ7jng6sjoVu9j3SyTjwRV2WOCAjEUYNLvPv7l4Bs GPRX73aipx5OK3CEyygLali1ISB05wEyH8rrMttBfk15ik8zIIFk6m83k5xsbZzGft04 IM5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TENTj6VWgaRIVHNM2e23VwFEcTKOckoi/K1jiDY0kJE=; b=HxQDgbQelh8ieRLJxRYfGUg2w3WWi4ZVRa3W4ogaJZ4qVrJ6pBvySJwWR9ms9YiWgw loEw4GL5cbwXYQhFc7Rwe+BfXRJgParCVUR51eZc+PRKh7x4aEgBPbaWUyt39Yx/E8qm 9qrAXkIhh9WF/7nfhw/akign3xsodncFlcW4uuHioLZqRu14jtJlybnC02K1+Vc7NR0h eNWwj5PGYvMFIvIG4PtxC52dLON0IbcSoH1DiOK+UC4DYc5iadfxbsXp2hVtv1EB+eKz rriDyM7j1K+fNwoF84+1+VzVE+/mPAQpFfUyaXZABeU/O2M53VT8RznAcz38yi2nqC7l Cxjw== X-Gm-Message-State: ALQs6tAO0GrvcBGgsTXz8IDSASNgF2QwQkpr/83jytHh3FqsVDd2NtpF ZGSJ+qVXo187PwDLadArwq+QhbdQHCI= X-Google-Smtp-Source: AB8JxZrJl4Mrk+d/A91WNntsIDWCkjcr8BlcUmJA0T3jG7368eLNwr0SXuIYM5j6NustcwYUFNNY2Q== X-Received: by 10.28.238.88 with SMTP id m85mr1438974wmh.44.1525097270062; Mon, 30 Apr 2018 07:07:50 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id o16sm8121592wmi.14.2018.04.30.07.07.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 07:07:49 -0700 (PDT) From: luca.boccassi@gmail.com To: Kumar Sanghvi Cc: Rahul Lakkireddy , dpdk stable Date: Mon, 30 Apr 2018 15:03:32 +0100 Message-Id: <20180430140606.4615-54-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180430140606.4615-1-luca.boccassi@gmail.com> References: <20180430140606.4615-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net/cxgbe: fix secondary process initialization' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2018 14:07:50 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/02/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 495dd8d6a49b45185b4ebc92ed9020f6f6ffcf0d Mon Sep 17 00:00:00 2001 From: Kumar Sanghvi Date: Wed, 28 Feb 2018 23:34:47 +0530 Subject: [PATCH] net/cxgbe: fix secondary process initialization [ upstream commit da5cf85e2da0fabe565085e66798ee0da2fc6697 ] Attach to rte_eth_dev devices allocated by Primary process for Ports other than Port-0 in the secondary process. Save the Primary rte_eth_dev device eth_dev_data as part of txq structure needed for tx path. Fixes: 8318984927ff ("cxgbe: add pmd skeleton") Signed-off-by: Kumar Sanghvi Signed-off-by: Rahul Lakkireddy --- doc/guides/nics/features/cxgbe.ini | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 33 ++++++++++++++++++++++++++------- drivers/net/cxgbe/sge.c | 5 +++-- 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/doc/guides/nics/features/cxgbe.ini b/doc/guides/nics/features/cxgbe.ini index 3d0fde2fd..1b9d81ffb 100644 --- a/doc/guides/nics/features/cxgbe.ini +++ b/doc/guides/nics/features/cxgbe.ini @@ -24,6 +24,7 @@ Basic stats = Y Stats per queue = Y EEPROM dump = Y Registers dump = Y +Multiprocess aware = Y BSD nic_uio = Y Linux UIO = Y Linux VFIO = Y diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index f2057af14..0c1a1be25 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -267,6 +267,7 @@ struct sge_eth_tx_stats { /* Ethernet tx queue statistics */ struct sge_eth_txq { /* state for an SGE Ethernet Tx queue */ struct sge_txq q; struct rte_eth_dev *eth_dev; /* port that this queue belongs to */ + struct rte_eth_dev_data *data; struct sge_eth_tx_stats stats; /* queue statistics */ rte_spinlock_t txq_lock; diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 5cd260f48..423a6957b 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1004,15 +1004,34 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->dev_ops = &cxgbe_eth_dev_ops; eth_dev->rx_pkt_burst = &cxgbe_recv_pkts; eth_dev->tx_pkt_burst = &cxgbe_xmit_pkts; - - /* for secondary processes, we don't initialise any further as primary - * has already done this work. - */ - if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; - pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + /* for secondary processes, we attach to ethdevs allocated by primary + * and do minimal initialization. + */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { + int i; + + for (i = 1; i < MAX_NPORTS; i++) { + struct rte_eth_dev *rest_eth_dev; + char namei[RTE_ETH_NAME_MAX_LEN]; + + snprintf(namei, sizeof(namei), "%s_%d", + pci_dev->device.name, i); + rest_eth_dev = rte_eth_dev_attach_secondary(namei); + if (rest_eth_dev) { + rest_eth_dev->device = &pci_dev->device; + rest_eth_dev->dev_ops = + eth_dev->dev_ops; + rest_eth_dev->rx_pkt_burst = + eth_dev->rx_pkt_burst; + rest_eth_dev->tx_pkt_burst = + eth_dev->tx_pkt_burst; + } + } + return 0; + } + snprintf(name, sizeof(name), "cxgbeadapter%d", eth_dev->data->port_id); adapter = rte_zmalloc(name, sizeof(*adapter), 0); if (!adapter) diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c index 3d5aa596f..6ff8bc46b 100644 --- a/drivers/net/cxgbe/sge.c +++ b/drivers/net/cxgbe/sge.c @@ -1095,7 +1095,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf, u32 wr_mid; u64 cntrl, *end; bool v6; - u32 max_pkt_len = txq->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; + u32 max_pkt_len = txq->data->dev_conf.rxmode.max_rx_pkt_len; /* Reject xmit if queue is stopped */ if (unlikely(txq->flags & EQ_STOPPED)) @@ -1115,7 +1115,7 @@ out_free: (unlikely(m->pkt_len > max_pkt_len))) goto out_free; - pi = (struct port_info *)txq->eth_dev->data->dev_private; + pi = (struct port_info *)txq->data->dev_private; adap = pi->adapter; cntrl = F_TXPKT_L4CSUM_DIS | F_TXPKT_IPCSUM_DIS; @@ -1997,6 +1997,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, txq->stats.mapping_err = 0; txq->flags |= EQ_STOPPED; txq->eth_dev = eth_dev; + txq->data = eth_dev->data; t4_os_lock_init(&txq->txq_lock); return 0; } -- 2.14.2