Hi Wolfgang,

first I reduced the receiver list of this discussion to the
more CAN related community. When things come to an end I will
add netdev and linux-usb again.

On Monday 10 May 2010 16:59, Wolfgang Grandegger wrote:
> On 05/10/2010 04:40 PM, Matthias Fuchs wrote:
> > Hi Wolfgang,
> > 
> > On Monday 10 May 2010 15:43, Wolfgang Grandegger wrote:
> >> Hi Matthias,
> >>
> >> On 05/10/2010 03:28 PM, Matthias Fuchs wrote:
> >>> This patch adds a driver for esd's USB high speed
> >>> CAN interface. The driver supports devices with
> >>> multiple CAN interfaces.
> >>>
> >>> Signed-off-by: Matthias Fuchs <[email protected]>
> >>> ---
> >>>
> >>> version 2: 
> >>>  - use bus-error reporting and counters
> >>
> >> I don't find support for CAN_CTRLMODE_BERR_REPORTING, apart from setting
> >> the flag. If it's set bus error interrupts should be enabled or disabled
> >> otherwise.
> >>
> >> Wolfgang.
> > I expect my implementation to be complete.
> > 
> > 1) In esd_usb2_rx_event() I pass tx/rxerr in cf->data[6/7].
> > 2) I implemented esd_usb2_get_berr_counter(). This function will 
> >    return the last tx/rx error counters from the hardware that
> >    are kept in priv->bec.
> > 3) tx/rx error counter cannot be requested from the hardware so
> >    they are stored in priv->bec when they are received from the hardware.
> >    There is no way to enable or disable this behavior.
> > 4) Finally I enabled the whole interface via CAN_CTRLMODE_BERR_REPORTING
> >    for the CAN framework.
> 
> BERR_REPORTING != bus error counter
> 
> > I don't see where I missed anything.
> 
> The equivalent to the following SJA1000 code is missing:
> 
>            /* enable interrupts */
>            if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
>                    priv->write_reg(priv, REG_IER, IRQ_ALL);
>            else
>                    priv->write_reg(priv, REG_IER, IRQ_ALL & ~IRQ_BEI);
> 
> The user must now explicitly enable bus error reporting with
> "ip ... type can berr_reporting on ....
This may be right. But we do not have an SJA1000 and the USB2 device 
automatically reports any change upstream. You do not really have a chance 
to turn on or off anything. So I only could hide some code when reporting is
turned off. But I am not really sure which code exactly.

Should I put some if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING) {}
around these lines in esd_usb2_rx_event()
...
                } else {
                        priv->can.can_stats.bus_error++;
                        stats->rx_errors++;

                        cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
                        ...

Matthias
_______________________________________________
Socketcan-core mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-core

Reply via email to