From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [dpdk-dev] [PATCH 1/2] net/txgbe: fix driver exit
Date: Tue, 27 Oct 2020 14:24:05 +0800 [thread overview]
Message-ID: <20201027062406.243081-1-jiawenwu@trustnetic.com> (raw)
Replace the 'rte_panic()' with an error return.
Also change the type of the calling function.
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
drivers/net/txgbe/txgbe_ethdev.h | 2 +-
drivers/net/txgbe/txgbe_pf.c | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/net/txgbe/txgbe_ethdev.h b/drivers/net/txgbe/txgbe_ethdev.h
index b708e6d43..fb1368890 100644
--- a/drivers/net/txgbe/txgbe_ethdev.h
+++ b/drivers/net/txgbe/txgbe_ethdev.h
@@ -290,7 +290,7 @@ void txgbe_configure_dcb(struct rte_eth_dev *dev);
int
txgbe_dev_link_update_share(struct rte_eth_dev *dev,
int wait_to_complete);
-void txgbe_pf_host_init(struct rte_eth_dev *eth_dev);
+int txgbe_pf_host_init(struct rte_eth_dev *eth_dev);
void txgbe_pf_host_uninit(struct rte_eth_dev *eth_dev);
diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c
index 67045fb01..ee7fa83fa 100644
--- a/drivers/net/txgbe/txgbe_pf.c
+++ b/drivers/net/txgbe/txgbe_pf.c
@@ -64,7 +64,7 @@ txgbe_mb_intr_setup(struct rte_eth_dev *dev)
return 0;
}
-void txgbe_pf_host_init(struct rte_eth_dev *eth_dev)
+int txgbe_pf_host_init(struct rte_eth_dev *eth_dev)
{
struct txgbe_vf_info **vfinfo = TXGBE_DEV_VFDATA(eth_dev);
struct txgbe_mirror_info *mirror_info = TXGBE_DEV_MR_INFO(eth_dev);
@@ -78,12 +78,14 @@ void txgbe_pf_host_init(struct rte_eth_dev *eth_dev)
RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
vf_num = dev_num_vf(eth_dev);
if (vf_num == 0)
- return;
+ return 0;
*vfinfo = rte_zmalloc("vf_info",
sizeof(struct txgbe_vf_info) * vf_num, 0);
- if (*vfinfo == NULL)
- rte_panic("Cannot allocate memory for private VF data\n");
+ if (*vfinfo == NULL) {
+ DEBUGOUT("Cannot allocate memory for private VF data\n");
+ return -ENOMEM;
+ }
rte_eth_switch_domain_alloc(&(*vfinfo)->switch_domain_id);
@@ -114,6 +116,8 @@ void txgbe_pf_host_init(struct rte_eth_dev *eth_dev)
/* set mb interrupt mask */
txgbe_mb_intr_setup(eth_dev);
+
+ return 0;
}
void txgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
--
2.21.0.windows.1
next reply other threads:[~2020-10-27 6:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 6:24 Jiawen Wu [this message]
2020-10-27 6:24 ` [dpdk-dev] [PATCH 2/2] net/txgbe: remove library name from version map file name Jiawen Wu
2020-10-27 10:54 ` Ferruh Yigit
2020-10-27 10:53 ` [dpdk-dev] [PATCH 1/2] net/txgbe: fix driver exit Ferruh Yigit
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=20201027062406.243081-1-jiawenwu@trustnetic.com \
--to=jiawenwu@trustnetic.com \
--cc=dev@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).