Skip to contentSkip to conversation

can-next rebase?

PATCH Oliver Hartkopp 2 participants 2 messages Jan 14, 2013 – Jan 15, 2013 CAN network drivers

lore
Share & tools
lore
#0 lore raw

Hello Marc,

it looks like that my request to Dave to revert a patch failed:

http://marc.info/?t=135799864800001&r=1&w=2

To prevent the routing of CAN frames back to the originating device i wanted to use skb->skb_iif (incoming interface index).

But skb->skb_iif is now *always* set in netif_receive_skb(), so it get's destroyed when going down to the CAN netdev and up again :-(

As we can not used the control buffer cb[] too (net/sched qdiscs are using the cb[] in the tx path), i was thinking about putting this information into the skb payload (into skb headroom).

This looks like this then:

+struct can_skb_priv {
+ int rx_ifindex;
+ struct can_frame cf[0];
+};
+

drivers/net/can/dev.c +8 -1
index 8233e5e..8233944 100644
@@ -500,14 +500,21 @@ static void can_setup(struct net_device *dev)
 struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
 {
 	struct sk_buff *skb;
+	struct can_skb_priv *cskbp;
 
-	skb = netdev_alloc_skb(dev, sizeof(struct can_frame));
+	skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) +
+			       sizeof(struct can_frame));
 	if (unlikely(!skb))
 		return NULL;
 
 	skb->protocol = htons(ETH_P_CAN);
 	skb->pkt_type = PACKET_BROADCAST;
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+	skb_reserve(skb, sizeof(struct can_skb_priv));
+	cskbp = (struct can_skb_priv *)skb->head;
+	cskbp->rx_ifindex = dev->ifindex;
+
 	*cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
 	memset(*cf, 0, sizeof(struct can_frame));
 

(..)

+ /* is sending the skb back to the incoming interface allowed? */
+ if (!(gwj->flags & CGW_FLAGS_CAN_IIF_TX_OK) &&
+ skb_headroom(skb) == sizeof(struct can_skb_priv)) {
+ struct can_skb_priv *cskbp = (struct can_skb_priv *)skb->head;
+
+ if (cskbp->rx_ifindex == gwj->dst.dev->ifindex)
+ return;
+ }
+

All the other handling with skb->data and skb->len remains stable with this approach.

But coming back to the mail topic:

I think i would need at least three patches for this change.

When trying to rebase linux-can-next the automatic merge fails ...

$ git rebase        
First, rewinding head to replay your work on top of it...
Applying: can: add tx/rx LED trigger support
Applying: can: flexcan: add LED trigger support
Applying: can: add tx/rx LED trigger support
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: can: flexcan: add LED trigger support
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: can: c_can: Add device tree support to Bosch C_CAN/D_CAN controller
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/can/c_can/c_can_platform.c
CONFLICT (content): Merge conflict in drivers/net/can/c_can/c_can_platform.c
Auto-merging Documentation/devicetree/bindings/net/can/c_can.txt
CONFLICT (add/add): Merge conflict in Documentation/devicetree/bindings/net/can/c_can.txt
Failed to merge in the changes.
Patch failed at 0005 can: c_can: Add device tree support to Bosch C_CAN/D_CAN controller

When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To check out the original branch and stop rebasing run "git rebase --abort".

Any idea?

Regards,
Oliver

#1 lore raw

On 01/14/2013 07:49 PM, Oliver Hartkopp wrote:

[...]

Quoted 28 lines

But coming back to the mail topic:

I think i would need at least three patches for this change.

When trying to rebase linux-can-next the automatic merge fails ...

$ git rebase        
First, rewinding head to replay your work on top of it...
Applying: can: add tx/rx LED trigger support
Applying: can: flexcan: add LED trigger support
Applying: can: add tx/rx LED trigger support
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: can: flexcan: add LED trigger support
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.
Applying: can: c_can: Add device tree support to Bosch C_CAN/D_CAN controller
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/can/c_can/c_can_platform.c
CONFLICT (content): Merge conflict in drivers/net/can/c_can/c_can_platform.c
Auto-merging Documentation/devicetree/bindings/net/can/c_can.txt
CONFLICT (add/add): Merge conflict in Documentation/devicetree/bindings/net/can/c_can.txt
Failed to merge in the changes.
Patch failed at 0005 can: c_can: Add device tree support to Bosch C_CAN/D_CAN controller
Quoted 3 lines

When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To check out the original branch and stop rebasing run "git rebase --abort".

The LED patches are not yet part or linux-can-next/master, linux-can-next/master was clean, a parent of net-next/master. However I've pushed net-next/master to linux-can-next/master.

I hope I'll find time today to pick up all outstanding patches and queue them.

Marc

Signature · 4 lines
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |