linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* can-next rebase?
@ 2013-01-14 18:49 Oliver Hartkopp
  2013-01-15  9:35 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Hartkopp @ 2013-01-14 18:49 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can@vger.kernel.org

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];
+};
+


diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 8233e5e..8233944 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: can-next rebase?
  2013-01-14 18:49 can-next rebase? Oliver Hartkopp
@ 2013-01-15  9:35 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2013-01-15  9:35 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: linux-can@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 2198 bytes --]

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

[...]

> 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".

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
-- 
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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-15  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 18:49 can-next rebase? Oliver Hartkopp
2013-01-15  9:35 ` Marc Kleine-Budde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).