Subject: Re: [patch 5/7] CAN: Add virtual CAN netdevice driver

From: Patrick McHardy <[email-masked]>
Date: Fri, 01 Jun 2007 16:54:56 +0200

Oliver Hartkopp wrote:
> Patrick McHardy wrote:
> 
>>Urs Thuermann wrote:
>>  
>>
>>>+	/* tx socket reference pointer: Loopback required if not NULL */
>>>+	loop = *(struct sock **)skb->cb != NULL;
>>>    
>>
>>
>>Qdiscs might change skb->cb. Maybe use skb->sk?
>>
>>  
> 
> due to current projects Urs and me had only a short time today to
> discuss the use of other skbuff-elements to implement the needed
> loopback functionality. Urs remembered that the value of skb->sk was not
> 'stable' in the whole loopback and therefore the use of skb->cb was a
> reasonable approach - and it was indeed working. Btw. triggered by your
> remark, we're looking for alternatives.

Yes, its working, but only in certain combinations and you're breaking
the rules for skb->cb, making it impossible for other layers to use.
skb->sk is "stable" at the output path, the regular loopback device
orphans the skb in hard_start_xmit. So you can at least use it there.

> Another thing is, that i would like to know, if Qdiscs would ever touch
> skb's containing CAN-frames?!?
> The MTU is 16 bytes (sizeof(struct can_frame)) and each skb contains
> exact one CAN-frame.
> What would a packet scheduler do with these skb's? IMO there is nothing
> that could be optimized and linked together like in IPv4 / IPv6 data.

Qdiscs don't care about the content. If a user attaches one to your
device, it will get used.

> Would therefore skb->cb left unchanged in my skb's? Or is there any flag
> that can be set in the skb to keep the packet scheduler's hands off?

No, and I don't think we want a flag to signal that something is
violating the rules for skb->cb, there are other users of this
besides qdiscs.