* [dpdk-dev] [PATCH] net/ifcvf: do not panic in address translation
@ 2018-04-20 15:15 Xiao Wang
2018-04-23 10:42 ` Ferruh Yigit
0 siblings, 1 reply; 2+ messages in thread
From: Xiao Wang @ 2018-04-20 15:15 UTC (permalink / raw)
To: ferruh.yigit; +Cc: dev, Xiao Wang
Driver should return error and report error message rather than call
rte_panic().
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/net/ifc/ifcvf_vdpa.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
index 27316a99f..26d70be18 100644
--- a/drivers/net/ifc/ifcvf_vdpa.c
+++ b/drivers/net/ifc/ifcvf_vdpa.c
@@ -226,8 +226,6 @@ qva_to_gpa(int vid, uint64_t qva)
}
exit:
- if (gpa == 0)
- rte_panic("failed to get gpa\n");
if (mem)
free(mem);
return gpa;
@@ -240,6 +238,7 @@ vdpa_ifcvf_start(struct ifcvf_internal *internal)
int i, nr_vring;
int vid;
struct rte_vhost_vring vq;
+ uint64_t gpa;
vid = internal->vid;
nr_vring = rte_vhost_get_vring_num(vid);
@@ -247,12 +246,27 @@ vdpa_ifcvf_start(struct ifcvf_internal *internal)
for (i = 0; i < nr_vring; i++) {
rte_vhost_get_vhost_vring(vid, i, &vq);
- hw->vring[i].desc = qva_to_gpa(vid,
- (uint64_t)(uintptr_t)vq.desc);
- hw->vring[i].avail = qva_to_gpa(vid,
- (uint64_t)(uintptr_t)vq.avail);
- hw->vring[i].used = qva_to_gpa(vid,
- (uint64_t)(uintptr_t)vq.used);
+ gpa = qva_to_gpa(vid, (uint64_t)(uintptr_t)vq.desc);
+ if (gpa == 0) {
+ DRV_LOG(ERR, "Fail to get GPA for descriptor ring.");
+ return -1;
+ }
+ hw->vring[i].desc = gpa;
+
+ gpa = qva_to_gpa(vid, (uint64_t)(uintptr_t)vq.avail);
+ if (gpa == 0) {
+ DRV_LOG(ERR, "Fail to get GPA for available ring.");
+ return -1;
+ }
+ hw->vring[i].avail = gpa;
+
+ gpa = qva_to_gpa(vid, (uint64_t)(uintptr_t)vq.used);
+ if (gpa == 0) {
+ DRV_LOG(ERR, "Fail to get GPA for used ring.");
+ return -1;
+ }
+ hw->vring[i].used = gpa;
+
hw->vring[i].size = vq.size;
rte_vhost_get_vring_base(vid, i, &hw->vring[i].last_avail_idx,
&hw->vring[i].last_used_idx);
--
2.15.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] net/ifcvf: do not panic in address translation
2018-04-20 15:15 [dpdk-dev] [PATCH] net/ifcvf: do not panic in address translation Xiao Wang
@ 2018-04-23 10:42 ` Ferruh Yigit
0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2018-04-23 10:42 UTC (permalink / raw)
To: Xiao Wang; +Cc: dev
On 4/20/2018 4:15 PM, Xiao Wang wrote:
> Driver should return error and report error message rather than call
> rte_panic().
>
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Squashed into relevant commit in next-net [1], thanks.
[1]
3c67b5fca918 ("net/ifcvf: add ifcvf vdpa driver")
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-23 10:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20 15:15 [dpdk-dev] [PATCH] net/ifcvf: do not panic in address translation Xiao Wang
2018-04-23 10:42 ` Ferruh Yigit
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).