From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by dpdk.org (Postfix) with ESMTP id B42F432A5 for ; Fri, 25 Jan 2019 09:10:34 +0100 (CET) Received: by mail-lj1-f196.google.com with SMTP id t9-v6so7601481ljh.6 for ; Fri, 25 Jan 2019 00:10:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RZjRj/gtlFNU1dw/fs+wmHHlDj97aQhEXAg4/4t231M=; b=tdzqTCJvbZN6iv8I4k8gHsIViVUEOJ4vhzL3SJUwWwithlla6mgms8pzCeu6hu8g+6 fiOMyvtzlKP35kHTGthfIk/QvxZtiVXdI03SE9Ra5TwyGDg7UaKU2vaf6qfLHcVunBUk Xk/EEF3ZI2fERM3/M5xjpG4y+GnhNOLWyt1/AswkGLkGiLVzmke086FoihrWpj8IkXDM qt5DoQQ4VY06uA58TUE+/j3enUfAiuPOWy+mCUv2UKh7JpYZr2/Drv1icp5Ps14R6SQU gYplwIvx9Rn4hrSXQae2n7JftUl2+2wHD1zOcpfosqMNWu/vk5ld6ShpjpXc68gwZWuv 6kAA== 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=RZjRj/gtlFNU1dw/fs+wmHHlDj97aQhEXAg4/4t231M=; b=IBwqKROj3sbtFkk0I7ZrU1rcNGgcxsggbTAKUJw7mxpYUtslAlbYxxN3/konrPvEGq uLSED9fBNqALZX7jutmJXk9npNMw9gqMmX2wE4C+z4iU1E1cQJfNQeP5OyPLaJEh5Z8E P5hz/9lRhyFEpzzpfYKJ751mR35/iZs7Mh7JgNRvXT8dRYbqxl5NDYskbRuPLnUSx0iY 83f2ryC3cQDhoRPAHgSTnwuIjQbD5f/j5J1/cEnraP3DBhp0K5gMFyTNPxhFg0LHcdaD B1DEkFqWDKAFNUUi7fz+nPkk8/DUCyeU7c5hom5xrQO0gqU8xYiZ6Oklqn7psoJATJtm x+nA== X-Gm-Message-State: AJcUukcK5Tqw0EBAaPbJkDs8QD5gnWvyORldENe/h5qh9NTUeZV7BYDV SfbWogv48f7j6fQShNdGRYEW3w== X-Google-Smtp-Source: ALg8bN4vbEahm8Kkx4jvf+r6lXCPy5HiiARHj8a0FKhJsNk5vZs/pEiNRduZJ1l/PBBtMkpiiMKodQ== X-Received: by 2002:a2e:9603:: with SMTP id v3-v6mr8062486ljh.15.1548403834312; Fri, 25 Jan 2019 00:10:34 -0800 (PST) Received: from localhost.localdomain ([185.157.12.197]) by smtp.gmail.com with ESMTPSA id m21sm1358664lfl.97.2019.01.25.00.10.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Jan 2019 00:10:33 -0800 (PST) From: Michal Krawczyk To: gtzalik@amazon.com, mw@semihalf.com, matua@amazon.com Cc: rk@semihalf.com, dev@dpdk.org, Michal Krawczyk , stable@dpdk.org Date: Fri, 25 Jan 2019 09:10:25 +0100 Message-Id: <1548403828-31870-3-git-send-email-mk@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1548403828-31870-1-git-send-email-mk@semihalf.com> References: <1548403828-31870-1-git-send-email-mk@semihalf.com> Subject: [dpdk-dev] [PATCH 2/5] net/ena: fix dev init for RTE_PROC_SECONDARY 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: Fri, 25 Jan 2019 08:10:34 -0000 The check for proc type in eth_ena_dev_init() should appear before modyfing adapter structure. Calling memset on ena_adapter from secondary process context, was erasing all structure information, and it was causing the crash of the main process. Fixes: 1173fca25af9 ("ena: add polling-mode driver") Cc: stable@dpdk.org Signed-off-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index fde5fa7..747390b 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1715,19 +1715,20 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) static int adapters_found; bool wd_state; - memset(adapter, 0, sizeof(struct ena_adapter)); - ena_dev = &adapter->ena_dev; - eth_dev->dev_ops = &ena_dev_ops; eth_dev->rx_pkt_burst = ð_ena_recv_pkts; eth_dev->tx_pkt_burst = ð_ena_xmit_pkts; eth_dev->tx_pkt_prepare = ð_ena_prep_pkts; - adapter->rte_eth_dev_data = eth_dev->data; - adapter->rte_dev = eth_dev; if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; + memset(adapter, 0, sizeof(struct ena_adapter)); + ena_dev = &adapter->ena_dev; + + adapter->rte_eth_dev_data = eth_dev->data; + adapter->rte_dev = eth_dev; + pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); adapter->pdev = pci_dev; -- 2.7.4