Re: Prolific 2501 link cable

Tobias <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Am Freitag, 5. Oktober 2007 11:49 schrieb Tobias:
> The function *pl_tx_fixup corrected:
>
>
> static struct sk_buff *pl_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
> gfp_t flags)
> {
> 	int	length = skb->len;
> 	u32	*packet_len;
>
> 	// attach the packet count to the header
> 	packet_len = (u32 *) skb_push(skb,4);
>
> 	*packet_len = cpu_to_le32(length);
>
> 	return skb;
> }

Sorry for this mail, it was sent inadvertently. The whole function now:

static struct sk_buff *pl_tx_fixup(struct usbnet *dev, struct sk_buff *skb, 
gfp_t flags)
{
	int 	padlen;
	int	length = skb->len;
	int	headroom = skb_headroom(skb);
	int	tailroom = skb_tailroom(skb);
	u32	*packet_len;

	// FIXME:  magic numbers, bleech
	padlen = ((skb->len + 4) % 64) ? 0 : 1;

	if ((!skb_cloned(skb))
			&& ((headroom + tailroom) >= (padlen + 4))) {
		if ((headroom < 4) || (tailroom < padlen)) {
			skb->data = memmove(skb->head + 4,
					     skb->data, skb->len);
			skb->tail = skb->data + skb->len;
		}
	} else {
		struct sk_buff	*skb2;
		skb2 = skb_copy_expand(skb,4,padlen,flags);
		dev_kfree_skb_any(skb);
		skb = skb2;
		if (!skb)
			return NULL;
	}

	// attach the packet count to the header
	packet_len = (u32 *) skb_push(skb,4);

	*packet_len = cpu_to_le32(length);

	return skb;
}

>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> [email protected]
> To unsubscribe, use the last form field at:
> https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.