From patchwork Mon Jan 13 19:12:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64577 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DD487A04F1; Mon, 13 Jan 2020 20:13:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 85CA01D174; Mon, 13 Jan 2020 20:12:53 +0100 (CET) Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by dpdk.org (Postfix) with ESMTP id ABEB11D153 for ; Mon, 13 Jan 2020 20:12:49 +0100 (CET) Received: by mail-pj1-f68.google.com with SMTP id a6so4564128pjh.2 for ; Mon, 13 Jan 2020 11:12:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yxIj6A0D1SZJ0xZvJ1qpglRW/a91k/5yg0nEiDGuLuA=; b=GJGD8WdY+m1cRU4uRySvlFV3Bzo8yHFBOSy1zmdmQ30nhQwd/qVjttoQDNDcAPz8yp GuVsfUe7RwY8oQ7kJ3RZoD1wTGJ6ygxnr9KSll30dcMEjcjcSvEvRqFjaljoxYqDGuIK 1Ao16geo9Prr1Wio5kwy1FgmRI5i0gPufIfQ70f2JhEcZKVN6FhEsSI8ImB7YlDg1qrU 1xjlLQ5Q3pe/VOol4+pJz9rzlBBYdjVULln/DNVyKagEGNPmR0eE9XBmKzZr7Pj8sWSo MvxWzuqdiYT4hzFHJQRP5RGulgC9w9SeM9ARwlVM2MR4BTDbjC4hk1b/rT/biRSNyvIx 1oBA== 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:mime-version:content-transfer-encoding; bh=yxIj6A0D1SZJ0xZvJ1qpglRW/a91k/5yg0nEiDGuLuA=; b=Q8yzAynsUDtgJg86rG07fth/iLa/0srGHhy1HnCp0/B4CQ+pTHgnqKuMISvceL1+69 M1FAbpu+LnwdP08VOUJy8o9iDq2LlDZWgR3KWueJnOntdief+H09KFvJAdn4a4tBTzlH cUeIx7zEPgNq4X5VziKHNygwXPwNGb98/JmqjKSKI461sZggstNR5E5Xfh9VYS6oCD39 hRusBUm9mVjgb2tJa7tmDnkirZF0WWDDOikdYRMiI5IbTL5yQW0aYEAQgyMz5bn9oPJf xlngpYDAv7z36NrK3p2MaOfgn55hKEWk8r2ajR4I7LN86ufyaJqRtFJH/Qh0iCuIHE0c aFCQ== X-Gm-Message-State: APjAAAVMGemWI7rn/gy2kiBjRGfQHp4VJqts0UAia1nz573+IfdBwDxp cjMH+M35Xg3w5HtD82yeOYK7opYUWKo= X-Google-Smtp-Source: APXvYqwL51btD+HwHPBx5hMM1KjSZQjzJeyVnqtdzuxiObWCTReqlePjE+hniU/7QvM2ybhQoSIIJA== X-Received: by 2002:a17:90a:e28e:: with SMTP id d14mr24915790pjz.56.1578942768293; Mon, 13 Jan 2020 11:12:48 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id f127sm15173723pfa.112.2020.01.13.11.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2020 11:12:47 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , stable@dpdk.org Date: Mon, 13 Jan 2020 11:12:38 -0800 Message-Id: <20200113191239.22750-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200113191239.22750-1-stephen@networkplumber.org> References: <20200113191239.22750-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 1/2] net/netvsc: fix crash in secondary process 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The secondary process would crash trying to get the offload capability of the device. Since the device capabilities were already set by the primary process this was unnecessary. Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger --- drivers/net/netvsc/hn_ethdev.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 159116f7f691..c79f924379fe 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -257,15 +257,16 @@ static int hn_dev_info_get(struct rte_eth_dev *dev, dev_info->max_rx_queues = hv->max_queues; dev_info->max_tx_queues = hv->max_queues; - rc = hn_rndis_get_offload(hv, dev_info); - if (rc != 0) - return rc; + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; - rc = hn_vf_info_get(hv, dev_info); + /* fills in rx and tx offload capability */ + rc = hn_rndis_get_offload(hv, dev_info); if (rc != 0) return rc; - return 0; + /* merges the offload and queues of vf */ + return hn_vf_info_get(hv, dev_info); } static int hn_rss_reta_update(struct rte_eth_dev *dev, @@ -929,6 +930,9 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) eth_dev->tx_pkt_burst = &hn_xmit_pkts; eth_dev->rx_pkt_burst = &hn_recv_pkts; + /* Since Hyper-V only supports one MAC address, just use local data */ + eth_dev->data->mac_addrs = &hv->mac_addr; + /* * for secondary processes, we don't initialize any further as primary * has already done this work. @@ -936,9 +940,6 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev) if (rte_eal_process_type() != RTE_PROC_PRIMARY) return 0; - /* Since Hyper-V only supports one MAC address, just use local data */ - eth_dev->data->mac_addrs = &hv->mac_addr; - hv->vmbus = vmbus; hv->rxbuf_res = &vmbus->resource[HV_RECV_BUF_MAP]; hv->chim_res = &vmbus->resource[HV_SEND_BUF_MAP];