Re: [PATCH net-next v3 2/2] usbnet: ipheth: add CDC NCM support

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

 



Hi,

On Sat, 2023-05-27 at 15:03 +0200, Foster Snowhill wrote:
> @@ -116,12 +124,12 @@ static int ipheth_alloc_urbs(struct ipheth_device *iphone)
>  	if (rx_urb == NULL)
>  		goto free_tx_urb;
>  
> -	tx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE,
> +	tx_buf = usb_alloc_coherent(iphone->udev, IPHETH_TX_BUF_SIZE,
>  				    GFP_KERNEL, &tx_urb->transfer_dma);
>  	if (tx_buf == NULL)
>  		goto free_rx_urb;
>  
> -	rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_BUF_SIZE + IPHETH_IP_ALIGN,
> +	rx_buf = usb_alloc_coherent(iphone->udev, IPHETH_RX_BUF_SIZE,
>  				    GFP_KERNEL, &rx_urb->transfer_dma);
>  	if (rx_buf == NULL)
>  		goto free_tx_buf;

Here the driver already knows if the device is in NCM or legacy mode,
so perhaps we could select the buffer size accordingly? You would
probably need to store the actual buffer size somewhere to keep the
buffer handling consistent and simple in later code.

> @@ -373,12 +489,10 @@ static netdev_tx_t ipheth_tx(struct sk_buff *skb, struct net_device *net)
>  	}
>  
>  	memcpy(dev->tx_buf, skb->data, skb->len);
> -	if (skb->len < IPHETH_BUF_SIZE)
> -		memset(dev->tx_buf + skb->len, 0, IPHETH_BUF_SIZE - skb->len);
>  
>  	usb_fill_bulk_urb(dev->tx_urb, udev,
>  			  usb_sndbulkpipe(udev, dev->bulk_out),
> -			  dev->tx_buf, IPHETH_BUF_SIZE,
> +			  dev->tx_buf, skb->len,
>  			  ipheth_sndbulk_callback,
>  			  dev);
>  	dev->tx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;

This chunk looks unrelated from NCM support, and unconditionally
changes the established behaviour even with legacy mode, why?

Does that works even with old(er) devices?

Thanks,

Paolo





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux