RE: [PATCH net] hyperv: Fix the error processing in netvsc_send()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Jason Wang [mailto:jasowang@xxxxxxxxxx]
> Sent: Friday, January 30, 2015 5:25 AM
> > +	if (ret != 0) {
> > +		if (section_index != NETVSC_INVALID_INDEX)
> > +			netvsc_free_send_slot(net_device, section_index);
> 
> What if ret is -EINVAL or -ENOSPC? Looks like we need free the skb in
> this case also.

In these cases, skb is freed in netvsc_start_xmit().


> >
> > +	} else if (skb) {
> > +		dev_kfree_skb_any(skb);
> 
> The caller - netvsc_start_xmit() do this also, may be handle this in
> caller is better since netvsc_start_xmit() is the only user that tries
> to send a skb?

When the packet is sent out normally, we frees it in netvsc_send() if it's
copied to send-buffer. The free is done in netvsc_send(), because the copy
is also in this function. If it's not copied, it will be freed in another
function -- netvsc_xmit_completion().

netvsc_start_xmit() only does free skb in error case.

> btw, I find during netvsc_start_xmit(), ret was change to -ENOSPC when
> queue_sends[q_idx] < 1. But non of the caller check -ENOSPC in fact?

In this case, we don't request re-send, so set ret to a value other than
-EAGAIN. It's handled in the same way as errors != -EAGAIN, so we don't
need to check this value specifically.

Thanks,
- Haiyang

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux