lkml.org 
[lkml]   [2021]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH V6 5/5] net: netvsc: Add Isolation VM support for netvsc driver
Date
From: Haiyang Zhang <haiyangz@microsoft.com> Sent: Wednesday, December 8, 2021 12:14 PM
> > From: Tianyu Lan <ltykernel@gmail.com>
> > Sent: Tuesday, December 7, 2021 2:56 AM

[snip]

> > static inline int netvsc_send_pkt(
> > struct hv_device *device,
> > struct hv_netvsc_packet *packet,
> > @@ -986,14 +1105,24 @@ static inline int netvsc_send_pkt(
> >
> > trace_nvsp_send_pkt(ndev, out_channel, rpkt);
> >
> > + packet->dma_range = NULL;
> > if (packet->page_buf_cnt) {
> > if (packet->cp_partial)
> > pb += packet->rmsg_pgcnt;
> >
> > + ret = netvsc_dma_map(ndev_ctx->device_ctx, packet, pb);
> > + if (ret) {
> > + ret = -EAGAIN;
> > + goto exit;
> > + }
>
> Returning EAGAIN will let the upper network layer busy retry,
> which may make things worse.
> I suggest to return ENOSPC here like another place in this
> function, which will just drop the packet, and let the network
> protocol/app layer decide how to recover.
>
> Thanks,
> - Haiyang

I made the original suggestion to return -EAGAIN here. A
DMA mapping failure should occur only if swiotlb bounce
buffer space is unavailable, which is a transient condition.
The existing code already stops the queue and returns
-EAGAIN when the ring buffer is full, which is also a transient
condition. My sense is that the two conditions should be
handled the same way. Or is there a reason why a ring
buffer full condition should stop the queue and retry, while
a mapping failure should drop the packet?

Michael

\
 
 \ /
  Last update: 2021-12-09 20:55    [W:0.091 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site