Wolfgang Grandegger wrote:
> Markus Plessing wrote:
>> Wolfgang Grandegger schrieb:
>>> Hi Markus,
>> Hi Wolfgang.
>>
>> Are we talking of the same? Think not.
>> Should I have changed the subject?
>
> I think so, but I do not see that the CAN TX done event is communicated
> over USB (like for the esd_usb2).
>
>>> Markus Plessing wrote:
>>>> Hi Wolfgang,
>>>>
>>>> Wolfgang Grandegger schrieb:
>>>>> Hi Mathias
>>>>>> +static void esd_usb2_tx_done_msg(struct esd_usb2_net *net, +
>>>>>> struct esd_usb2_msg *msg) +{ + struct net_device_stats *stats =
>>>>>> &net->netdev->stats; + + if
>>>>>> (!netif_device_present(net->netdev)) + return; + + if
>>>>>> (msg->msg.txdone.status == 0) { + stats->tx_packets++; +
>>>>>> stats->tx_bytes += msg->msg.txdone.hnd & 0xf; + } +} [...] + +
>>>>>> netdev->trans_start = jiffies; + + can_get_echo_skb(netdev,
>>>>>> context->echo_index);
>>>>> This functions is called when the USB transfer has completed,
>>>>> right? can_get_echo_skb() should be called when the TX done
>>>>> notification arrives (in esd_usb2_tx_done_msg). This is *wrong*
>>>>> in the ems_usb driver as well and should be fixed. Wolfgang.
>>>> The ems_usb driver increments the tx_packets and tx_bytes before
>>>> the call to can_get_echo_skb. Is there anything more to do? I don't
>>>> see a need of a fix in ems_usb or am I wrong?
>>> can_get_echo_skb() should be called in esd_usb2_tx_done_msg().
>>
>> [...] out of context above [...]
>> >>> This is *wrong* in the ems_usb driver as well and should be fixed.
>> [...] out of context [...]
>>
>>
>> You mentioned that the issue rised in *esd usb2 driver* is also a issue
>> for the *ems_usb driver*. IMO this is not the case.
>>
>> Can you please clarify this for *ems_usb*? Thanks :-)
>
> can_get_echo_skb() (and also netdev->stats.tx_packets++, etc.) is
> currently called in ems_usb_write_bulk_callback(). This function is
> called when the *USB* transfer has completed, I believe. But
> can_get_echo_skb() should be called when the *CAN* TX done event is
> signaled (by the SJA1000). This is important to ensure proper timing of
> locally looped back (echoed) messages. Is the problem clear now?
The question is, if it makes sense for USB devices to support IFF_ECHO
(http://lxr.linux.no/#linux+v2.6.32/Documentation/networking/can.txt#L569)
at all. Oliver, what do you think?
Wolfgang.
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core