RE: [PATCH] flexcan: Fix CAN_RAW_RECV_OWN_MSGS and CAN_RAW_LOOPBACK
From: Reuben Dowle <hidden>
Date: 2011-11-02 00:25:07
Also in:
linux-can
Patch looks quite good. Can you please wrap the description to about 72 chars?
Will do.
quoted
}@@ -670,6 +671,8 @@ static int flexcan_chip_start(struct net_device*dev)quoted
int err; u32 reg_mcr, reg_ctrl; + can_free_echo_skb(dev, 0);what about putting this to flexcan_chip_stop? Otherwise you risk a memleak if you do "ifconfig down; rmmod flexcan"
I originally thought this needs to be in flexcan_chip_start, so the bus off followed by restart sequence will drop the loopback packet. I investigated a bit deeper and can_flush_echo_skb is called in can_restart(). So my call of that function is not really needed. can_flush_echo_skb is also called in close_candev, which is called by the flexcan driver. So I actually think this function does not need to be called by the driver at all. What do you think?
quoted
dev->netdev_ops = &flexcan_netdev_ops; dev->irq = irq; - dev->flags |= IFF_ECHO; /* we support local echo in hardware */ + + /* Driver supports local echo. + * We support local echo in hardware, however this is not usedbecausequoted
+ * hardware local echo loses the sending socket reference + * (thus CAN_RAW_RECV_OWN_MSGS and CAN_RAW_LOOPBACK socketoptionsquoted
+ * would not work) + */IMHO, you can skip this comment. The patch description is good enough.
Ok, I will drop the extra comments from the patch.