patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: stable@dpdk.org
Cc: ktraynor@redhat.com, ferruh.yigit@intel.com
Subject: [dpdk-stable] [PATCH 18.08] net/softnic: fix undefined dev info fields
Date: Thu, 29 Nov 2018 14:52:26 +0000	[thread overview]
Message-ID: <20181129145226.58362-1-jasvinder.singh@intel.com> (raw)

The memcpy operation overwrites the device info fields set
by ethdev API and leaves the device field undefined.
Thus, replaces memcpy by only updating the required fields
at the driver layer.

error log: testpmd> show port info 1

**** Infos for port 1  ****
MAC address: 00:00:00:00:00:00
Device name: net_softnic0

Segmentation fault.
port_infos_display (port_id=1) at /dpdk/app/test-pmd/config.c:418
if (dev_info.device->devargs && dev_info.device->devargs->args)

Fixes: cc6d421574fe ("net/softnic: add softnic PMD")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/softnic/rte_eth_softnic.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 3e47c2f98..45a2922b7 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -79,28 +79,13 @@ static const char *pmd_valid_args[] = {
 	NULL
 };
 
-static const struct rte_eth_dev_info pmd_dev_info = {
-	.min_rx_bufsize = 0,
-	.max_rx_pktlen = UINT32_MAX,
-	.max_rx_queues = UINT16_MAX,
-	.max_tx_queues = UINT16_MAX,
-	.rx_desc_lim = {
-		.nb_max = UINT16_MAX,
-		.nb_min = 0,
-		.nb_align = 1,
-	},
-	.tx_desc_lim = {
-		.nb_max = UINT16_MAX,
-		.nb_min = 0,
-		.nb_align = 1,
-	},
-};
-
 static void
 pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused,
 	struct rte_eth_dev_info *dev_info)
 {
-	memcpy(dev_info, &pmd_dev_info, sizeof(*dev_info));
+	dev_info->max_rx_pktlen = UINT32_MAX;
+	dev_info->max_rx_queues = UINT16_MAX;
+	dev_info->max_tx_queues = UINT16_MAX;
 }
 
 static int
-- 
2.17.1

                 reply	other threads:[~2018-11-29 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181129145226.58362-1-jasvinder.singh@intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=ferruh.yigit@intel.com \
    --cc=ktraynor@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).