linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] can: replace timestamp as unique skb attribute
@ 2015-06-26  9:58 Oliver Hartkopp
  2015-07-01  8:01 ` Marc Kleine-Budde
  2015-07-13  9:26 ` Manfred Schlaegl
  0 siblings, 2 replies; 7+ messages in thread
From: Oliver Hartkopp @ 2015-06-26  9:58 UTC (permalink / raw)
  To: linux-can; +Cc: manfred.schlaegl, tom_usenet, s.grosjean, Oliver Hartkopp

Commit 514ac99c64b "can: fix multiple delivery of a single CAN frame for
overlapping CAN filters" requires the skb->tstamp to be set to check for
identical CAN skbs.

Without timestamping to be required by user space applications this timestamp
was not generated which lead to commit 36c01245eb8 "can: fix loss of CAN
frames in raw_rcv" - which forces the timestamp to be set in all CAN related
skbuffs by introducing several __net_timestamp() calls.

This forces e.g. out of tree drivers to add __net_timestamp() after skbuff
creation to prevent the frame loss fixed in mainline Linux.

This patch removes the timestamp dependency and uses an atomic counter to
create an unique identifier together with the skbuff pointer.

Btw. the new skbcnt element introduced in struct can_skb_priv has to be
initialized with zero in out-of-tree drivers too.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
 drivers/net/can/dev.c   |  7 ++-----
 drivers/net/can/slcan.c |  2 +-
 drivers/net/can/vcan.c  |  3 ---
 include/linux/can/skb.h |  2 ++
 net/can/af_can.c        | 12 +++++++-----
 net/can/bcm.c           |  2 ++
 net/can/raw.c           |  7 ++++---
 7 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index e9b1810..aede704 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -440,9 +440,6 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
 		struct can_frame *cf = (struct can_frame *)skb->data;
 		u8 dlc = cf->can_dlc;
 
-		if (!(skb->tstamp.tv64))
-			__net_timestamp(skb);
-
 		netif_rx(priv->echo_skb[idx]);
 		priv->echo_skb[idx] = NULL;
 
@@ -578,7 +575,6 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
 	if (unlikely(!skb))
 		return NULL;
 
-	__net_timestamp(skb);
 	skb->protocol = htons(ETH_P_CAN);
 	skb->pkt_type = PACKET_BROADCAST;
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -589,6 +585,7 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
 
 	can_skb_reserve(skb);
 	can_skb_prv(skb)->ifindex = dev->ifindex;
+	can_skb_prv(skb)->skbcnt = 0;
 
 	*cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
 	memset(*cf, 0, sizeof(struct can_frame));
@@ -607,7 +604,6 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
 	if (unlikely(!skb))
 		return NULL;
 
-	__net_timestamp(skb);
 	skb->protocol = htons(ETH_P_CANFD);
 	skb->pkt_type = PACKET_BROADCAST;
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -618,6 +614,7 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
 
 	can_skb_reserve(skb);
 	can_skb_prv(skb)->ifindex = dev->ifindex;
+	can_skb_prv(skb)->skbcnt = 0;
 
 	*cfd = (struct canfd_frame *)skb_put(skb, sizeof(struct canfd_frame));
 	memset(*cfd, 0, sizeof(struct canfd_frame));
diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
index f64f529..a23a7af 100644
--- a/drivers/net/can/slcan.c
+++ b/drivers/net/can/slcan.c
@@ -207,7 +207,6 @@ static void slc_bump(struct slcan *sl)
 	if (!skb)
 		return;
 
-	__net_timestamp(skb);
 	skb->dev = sl->dev;
 	skb->protocol = htons(ETH_P_CAN);
 	skb->pkt_type = PACKET_BROADCAST;
@@ -215,6 +214,7 @@ static void slc_bump(struct slcan *sl)
 
 	can_skb_reserve(skb);
 	can_skb_prv(skb)->ifindex = sl->dev->ifindex;
+	can_skb_prv(skb)->skbcnt = 0;
 
 	memcpy(skb_put(skb, sizeof(struct can_frame)),
 	       &cf, sizeof(struct can_frame));
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
index 0ce868d..674f367 100644
--- a/drivers/net/can/vcan.c
+++ b/drivers/net/can/vcan.c
@@ -78,9 +78,6 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
 	skb->dev       = dev;
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 
-	if (!(skb->tstamp.tv64))
-		__net_timestamp(skb);
-
 	netif_rx_ni(skb);
 }
 
diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
index b6a52a4..51bb653 100644
--- a/include/linux/can/skb.h
+++ b/include/linux/can/skb.h
@@ -27,10 +27,12 @@
 /**
  * struct can_skb_priv - private additional data inside CAN sk_buffs
  * @ifindex:	ifindex of the first interface the CAN frame appeared on
+ * @skbcnt:	atomic counter to have an unique id together with skb pointer
  * @cf:		align to the following CAN frame at skb->data
  */
 struct can_skb_priv {
 	int ifindex;
+	int skbcnt;
 	struct can_frame cf[0];
 };
 
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 689c818..62c635f 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -89,6 +89,8 @@ struct timer_list can_stattimer;   /* timer for statistics update */
 struct s_stats    can_stats;       /* packet statistics */
 struct s_pstats   can_pstats;      /* receive list statistics */
 
+static atomic_t skbcounter = ATOMIC_INIT(0);
+
 /*
  * af_can socket functions
  */
@@ -310,12 +312,8 @@ int can_send(struct sk_buff *skb, int loop)
 		return err;
 	}
 
-	if (newskb) {
-		if (!(newskb->tstamp.tv64))
-			__net_timestamp(newskb);
-
+	if (newskb)
 		netif_rx_ni(newskb);
-	}
 
 	/* update statistics */
 	can_stats.tx_frames++;
@@ -683,6 +681,10 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev)
 	can_stats.rx_frames++;
 	can_stats.rx_frames_delta++;
 
+	/* create non-zero unique skb identifier together with *skb */
+	while (!(can_skb_prv(skb)->skbcnt))
+		can_skb_prv(skb)->skbcnt = atomic_inc_return(&skbcounter);
+
 	rcu_read_lock();
 
 	/* deliver the packet to sockets listening on all devices */
diff --git a/net/can/bcm.c b/net/can/bcm.c
index b523453..a1ba687 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -261,6 +261,7 @@ static void bcm_can_tx(struct bcm_op *op)
 
 	can_skb_reserve(skb);
 	can_skb_prv(skb)->ifindex = dev->ifindex;
+	can_skb_prv(skb)->skbcnt = 0;
 
 	memcpy(skb_put(skb, CFSIZ), cf, CFSIZ);
 
@@ -1217,6 +1218,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk)
 	}
 
 	can_skb_prv(skb)->ifindex = dev->ifindex;
+	can_skb_prv(skb)->skbcnt = 0;
 	skb->dev = dev;
 	can_skb_set_owner(skb, sk);
 	err = can_send(skb, 1); /* send with loopback */
diff --git a/net/can/raw.c b/net/can/raw.c
index 31b9748..2e67b14 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -75,7 +75,7 @@ MODULE_ALIAS("can-proto-1");
  */
 
 struct uniqframe {
-	ktime_t tstamp;
+	int skbcnt;
 	const struct sk_buff *skb;
 	unsigned int join_rx_count;
 };
@@ -133,7 +133,7 @@ static void raw_rcv(struct sk_buff *oskb, void *data)
 
 	/* eliminate multiple filter matches for the same skb */
 	if (this_cpu_ptr(ro->uniq)->skb == oskb &&
-	    ktime_equal(this_cpu_ptr(ro->uniq)->tstamp, oskb->tstamp)) {
+	    this_cpu_ptr(ro->uniq)->skbcnt == can_skb_prv(oskb)->skbcnt) {
 		if (ro->join_filters) {
 			this_cpu_inc(ro->uniq->join_rx_count);
 			/* drop frame until all enabled filters matched */
@@ -144,7 +144,7 @@ static void raw_rcv(struct sk_buff *oskb, void *data)
 		}
 	} else {
 		this_cpu_ptr(ro->uniq)->skb = oskb;
-		this_cpu_ptr(ro->uniq)->tstamp = oskb->tstamp;
+		this_cpu_ptr(ro->uniq)->skbcnt = can_skb_prv(oskb)->skbcnt;
 		this_cpu_ptr(ro->uniq)->join_rx_count = 1;
 		/* drop first frame to check all enabled filters? */
 		if (ro->join_filters && ro->count > 1)
@@ -749,6 +749,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
 
 	can_skb_reserve(skb);
 	can_skb_prv(skb)->ifindex = dev->ifindex;
+	can_skb_prv(skb)->skbcnt = 0;
 
 	err = memcpy_from_msg(skb_put(skb, size), msg, size);
 	if (err < 0)
-- 
2.1.4


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

* Re: [PATCH RFC] can: replace timestamp as unique skb attribute
  2015-06-26  9:58 [PATCH RFC] can: replace timestamp as unique skb attribute Oliver Hartkopp
@ 2015-07-01  8:01 ` Marc Kleine-Budde
  2015-07-04 16:00   ` Oliver Hartkopp
  2015-07-13  9:26 ` Manfred Schlaegl
  1 sibling, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2015-07-01  8:01 UTC (permalink / raw)
  To: Oliver Hartkopp, linux-can; +Cc: manfred.schlaegl, tom_usenet, s.grosjean

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

On 06/26/2015 11:58 AM, Oliver Hartkopp wrote:
> Commit 514ac99c64b "can: fix multiple delivery of a single CAN frame for
> overlapping CAN filters" requires the skb->tstamp to be set to check for
> identical CAN skbs.
> 
> Without timestamping to be required by user space applications this timestamp
> was not generated which lead to commit 36c01245eb8 "can: fix loss of CAN
> frames in raw_rcv" - which forces the timestamp to be set in all CAN related
> skbuffs by introducing several __net_timestamp() calls.
> 
> This forces e.g. out of tree drivers to add __net_timestamp() after skbuff
> creation to prevent the frame loss fixed in mainline Linux.
> 
> This patch removes the timestamp dependency and uses an atomic counter to
> create an unique identifier together with the skbuff pointer.
> 
> Btw. the new skbcnt element introduced in struct can_skb_priv has to be
> initialized with zero in out-of-tree drivers too.

...but only if they don't use alloc_can{,fd}_skb().	

Looks much better than the timestamp approach. I'll apply it to
can/master if there aren't any objections. What about stable?

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: 455 bytes --]

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

* Re: [PATCH RFC] can: replace timestamp as unique skb attribute
  2015-07-01  8:01 ` Marc Kleine-Budde
@ 2015-07-04 16:00   ` Oliver Hartkopp
  0 siblings, 0 replies; 7+ messages in thread
From: Oliver Hartkopp @ 2015-07-04 16:00 UTC (permalink / raw)
  To: Marc Kleine-Budde, linux-can; +Cc: manfred.schlaegl, tom_usenet, s.grosjean

On 01.07.2015 10:01, Marc Kleine-Budde wrote:
> On 06/26/2015 11:58 AM, Oliver Hartkopp wrote:
>> Commit 514ac99c64b "can: fix multiple delivery of a single CAN frame for
>> overlapping CAN filters" requires the skb->tstamp to be set to check for
>> identical CAN skbs.
>>
>> Without timestamping to be required by user space applications this timestamp
>> was not generated which lead to commit 36c01245eb8 "can: fix loss of CAN
>> frames in raw_rcv" - which forces the timestamp to be set in all CAN related
>> skbuffs by introducing several __net_timestamp() calls.
>>
>> This forces e.g. out of tree drivers to add __net_timestamp() after skbuff
>> creation to prevent the frame loss fixed in mainline Linux.
>>
>> This patch removes the timestamp dependency and uses an atomic counter to
>> create an unique identifier together with the skbuff pointer.
>>
>> Btw. the new skbcnt element introduced in struct can_skb_priv has to be
>> initialized with zero in out-of-tree drivers too.
>
> ...but only if they don't use alloc_can{,fd}_skb().	

Right. Is it possible to add this fact to the commit message?

>
> Looks much better than the timestamp approach. I'll apply it to
> can/master if there aren't any objections. What about stable?

Yes. I definitely would like to have it in 4.1.x.

Currently GregKH has commit 514ac99c64b queued up for 4.1.2:

http://git.kernel.org/cgit/linux/kernel/git/stable/stable-queue.git/commit/?id=d722d86cbddfbe6442cbb548a548344d1e3e441a

So my favourite would be to have it in 4.1.2 too to have only 4.1.0 and 4.1.1 
dysfunctional and a proper requirement with can_skb_prv(skb)->skbcnt to be set 
in 4.1.2+

Best regards,
Oliver

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

* Re: [PATCH RFC] can: replace timestamp as unique skb attribute
  2015-06-26  9:58 [PATCH RFC] can: replace timestamp as unique skb attribute Oliver Hartkopp
  2015-07-01  8:01 ` Marc Kleine-Budde
@ 2015-07-13  9:26 ` Manfred Schlaegl
  2015-07-13  9:38   ` Marc Kleine-Budde
  1 sibling, 1 reply; 7+ messages in thread
From: Manfred Schlaegl @ 2015-07-13  9:26 UTC (permalink / raw)
  To: Oliver Hartkopp, linux-can; +Cc: tom_usenet, s.grosjean

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

On 2015-06-26 11:58, Oliver Hartkopp wrote:
> Commit 514ac99c64b "can: fix multiple delivery of a single CAN frame for
> overlapping CAN filters" requires the skb->tstamp to be set to check for
> identical CAN skbs.
> 
> Without timestamping to be required by user space applications this timestamp
> was not generated which lead to commit 36c01245eb8 "can: fix loss of CAN
> frames in raw_rcv" - which forces the timestamp to be set in all CAN related
> skbuffs by introducing several __net_timestamp() calls.
> 
> This forces e.g. out of tree drivers to add __net_timestamp() after skbuff
> creation to prevent the frame loss fixed in mainline Linux.
> 
> This patch removes the timestamp dependency and uses an atomic counter to
> create an unique identifier together with the skbuff pointer.
> 
> Btw. the new skbcnt element introduced in struct can_skb_priv has to be
> initialized with zero in out-of-tree drivers too.
> 
> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
> ---
>  drivers/net/can/dev.c   |  7 ++-----
>  drivers/net/can/slcan.c |  2 +-
>  drivers/net/can/vcan.c  |  3 ---
>  include/linux/can/skb.h |  2 ++
>  net/can/af_can.c        | 12 +++++++-----
>  net/can/bcm.c           |  2 ++
>  net/can/raw.c           |  7 ++++---
>  7 files changed, 18 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
> index e9b1810..aede704 100644
> --- a/drivers/net/can/dev.c
> +++ b/drivers/net/can/dev.c
> @@ -440,9 +440,6 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
>  		struct can_frame *cf = (struct can_frame *)skb->data;
>  		u8 dlc = cf->can_dlc;
>  
> -		if (!(skb->tstamp.tv64))
> -			__net_timestamp(skb);
> -
>  		netif_rx(priv->echo_skb[idx]);
>  		priv->echo_skb[idx] = NULL;
>  
> @@ -578,7 +575,6 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
>  	if (unlikely(!skb))
>  		return NULL;
>  
> -	__net_timestamp(skb);
>  	skb->protocol = htons(ETH_P_CAN);
>  	skb->pkt_type = PACKET_BROADCAST;
>  	skb->ip_summed = CHECKSUM_UNNECESSARY;
> @@ -589,6 +585,7 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
>  
>  	can_skb_reserve(skb);
>  	can_skb_prv(skb)->ifindex = dev->ifindex;
> +	can_skb_prv(skb)->skbcnt = 0;
>  
>  	*cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
>  	memset(*cf, 0, sizeof(struct can_frame));
> @@ -607,7 +604,6 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
>  	if (unlikely(!skb))
>  		return NULL;
>  
> -	__net_timestamp(skb);
>  	skb->protocol = htons(ETH_P_CANFD);
>  	skb->pkt_type = PACKET_BROADCAST;
>  	skb->ip_summed = CHECKSUM_UNNECESSARY;
> @@ -618,6 +614,7 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
>  
>  	can_skb_reserve(skb);
>  	can_skb_prv(skb)->ifindex = dev->ifindex;
> +	can_skb_prv(skb)->skbcnt = 0;
>  
>  	*cfd = (struct canfd_frame *)skb_put(skb, sizeof(struct canfd_frame));
>  	memset(*cfd, 0, sizeof(struct canfd_frame));
> diff --git a/drivers/net/can/slcan.c b/drivers/net/can/slcan.c
> index f64f529..a23a7af 100644
> --- a/drivers/net/can/slcan.c
> +++ b/drivers/net/can/slcan.c
> @@ -207,7 +207,6 @@ static void slc_bump(struct slcan *sl)
>  	if (!skb)
>  		return;
>  
> -	__net_timestamp(skb);
>  	skb->dev = sl->dev;
>  	skb->protocol = htons(ETH_P_CAN);
>  	skb->pkt_type = PACKET_BROADCAST;
> @@ -215,6 +214,7 @@ static void slc_bump(struct slcan *sl)
>  
>  	can_skb_reserve(skb);
>  	can_skb_prv(skb)->ifindex = sl->dev->ifindex;
> +	can_skb_prv(skb)->skbcnt = 0;
>  
>  	memcpy(skb_put(skb, sizeof(struct can_frame)),
>  	       &cf, sizeof(struct can_frame));
> diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
> index 0ce868d..674f367 100644
> --- a/drivers/net/can/vcan.c
> +++ b/drivers/net/can/vcan.c
> @@ -78,9 +78,6 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
>  	skb->dev       = dev;
>  	skb->ip_summed = CHECKSUM_UNNECESSARY;
>  
> -	if (!(skb->tstamp.tv64))
> -		__net_timestamp(skb);
> -
>  	netif_rx_ni(skb);
>  }
>  
> diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h
> index b6a52a4..51bb653 100644
> --- a/include/linux/can/skb.h
> +++ b/include/linux/can/skb.h
> @@ -27,10 +27,12 @@
>  /**
>   * struct can_skb_priv - private additional data inside CAN sk_buffs
>   * @ifindex:	ifindex of the first interface the CAN frame appeared on
> + * @skbcnt:	atomic counter to have an unique id together with skb pointer
>   * @cf:		align to the following CAN frame at skb->data
>   */
>  struct can_skb_priv {
>  	int ifindex;
> +	int skbcnt;
>  	struct can_frame cf[0];
>  };
>  
> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index 689c818..62c635f 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -89,6 +89,8 @@ struct timer_list can_stattimer;   /* timer for statistics update */
>  struct s_stats    can_stats;       /* packet statistics */
>  struct s_pstats   can_pstats;      /* receive list statistics */
>  
> +static atomic_t skbcounter = ATOMIC_INIT(0);
> +
>  /*
>   * af_can socket functions
>   */
> @@ -310,12 +312,8 @@ int can_send(struct sk_buff *skb, int loop)
>  		return err;
>  	}
>  
> -	if (newskb) {
> -		if (!(newskb->tstamp.tv64))
> -			__net_timestamp(newskb);
> -
> +	if (newskb)
>  		netif_rx_ni(newskb);
> -	}
>  
>  	/* update statistics */
>  	can_stats.tx_frames++;
> @@ -683,6 +681,10 @@ static void can_receive(struct sk_buff *skb, struct net_device *dev)
>  	can_stats.rx_frames++;
>  	can_stats.rx_frames_delta++;
>  
> +	/* create non-zero unique skb identifier together with *skb */
> +	while (!(can_skb_prv(skb)->skbcnt))
> +		can_skb_prv(skb)->skbcnt = atomic_inc_return(&skbcounter);
> +
>  	rcu_read_lock();
>  
>  	/* deliver the packet to sockets listening on all devices */
> diff --git a/net/can/bcm.c b/net/can/bcm.c
> index b523453..a1ba687 100644
> --- a/net/can/bcm.c
> +++ b/net/can/bcm.c
> @@ -261,6 +261,7 @@ static void bcm_can_tx(struct bcm_op *op)
>  
>  	can_skb_reserve(skb);
>  	can_skb_prv(skb)->ifindex = dev->ifindex;
> +	can_skb_prv(skb)->skbcnt = 0;
>  
>  	memcpy(skb_put(skb, CFSIZ), cf, CFSIZ);
>  
> @@ -1217,6 +1218,7 @@ static int bcm_tx_send(struct msghdr *msg, int ifindex, struct sock *sk)
>  	}
>  
>  	can_skb_prv(skb)->ifindex = dev->ifindex;
> +	can_skb_prv(skb)->skbcnt = 0;
>  	skb->dev = dev;
>  	can_skb_set_owner(skb, sk);
>  	err = can_send(skb, 1); /* send with loopback */
> diff --git a/net/can/raw.c b/net/can/raw.c
> index 31b9748..2e67b14 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -75,7 +75,7 @@ MODULE_ALIAS("can-proto-1");
>   */
>  
>  struct uniqframe {
> -	ktime_t tstamp;
> +	int skbcnt;
>  	const struct sk_buff *skb;
>  	unsigned int join_rx_count;
>  };
> @@ -133,7 +133,7 @@ static void raw_rcv(struct sk_buff *oskb, void *data)
>  
>  	/* eliminate multiple filter matches for the same skb */
>  	if (this_cpu_ptr(ro->uniq)->skb == oskb &&
> -	    ktime_equal(this_cpu_ptr(ro->uniq)->tstamp, oskb->tstamp)) {
> +	    this_cpu_ptr(ro->uniq)->skbcnt == can_skb_prv(oskb)->skbcnt) {
>  		if (ro->join_filters) {
>  			this_cpu_inc(ro->uniq->join_rx_count);
>  			/* drop frame until all enabled filters matched */
> @@ -144,7 +144,7 @@ static void raw_rcv(struct sk_buff *oskb, void *data)
>  		}
>  	} else {
>  		this_cpu_ptr(ro->uniq)->skb = oskb;
> -		this_cpu_ptr(ro->uniq)->tstamp = oskb->tstamp;
> +		this_cpu_ptr(ro->uniq)->skbcnt = can_skb_prv(oskb)->skbcnt;
>  		this_cpu_ptr(ro->uniq)->join_rx_count = 1;
>  		/* drop first frame to check all enabled filters? */
>  		if (ro->join_filters && ro->count > 1)
> @@ -749,6 +749,7 @@ static int raw_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
>  
>  	can_skb_reserve(skb);
>  	can_skb_prv(skb)->ifindex = dev->ifindex;
> +	can_skb_prv(skb)->skbcnt = 0;
>  
>  	err = memcpy_from_msg(skb_put(skb, size), msg, size);
>  	if (err < 0)
> 

I've tested this in my original situation on i.MX6Q so I can give a

Tested-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>

best regards,
manfred


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

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

* Re: [PATCH RFC] can: replace timestamp as unique skb attribute
  2015-07-13  9:26 ` Manfred Schlaegl
@ 2015-07-13  9:38   ` Marc Kleine-Budde
  2015-07-13  9:40     ` Manfred Schlaegl
  0 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2015-07-13  9:38 UTC (permalink / raw)
  To: Manfred Schlaegl, Oliver Hartkopp, linux-can; +Cc: tom_usenet, s.grosjean

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

On 07/13/2015 11:26 AM, Manfred Schlaegl wrote:
> I've tested this in my original situation on i.MX6Q so I can give a
> 
> Tested-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>

Thanks. The patch is already upstream so I cannot add your Tested-by.

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: 455 bytes --]

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

* Re: [PATCH RFC] can: replace timestamp as unique skb attribute
  2015-07-13  9:38   ` Marc Kleine-Budde
@ 2015-07-13  9:40     ` Manfred Schlaegl
  2015-07-13  9:42       ` Marc Kleine-Budde
  0 siblings, 1 reply; 7+ messages in thread
From: Manfred Schlaegl @ 2015-07-13  9:40 UTC (permalink / raw)
  To: Marc Kleine-Budde, Oliver Hartkopp, linux-can; +Cc: tom_usenet, s.grosjean

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

On 2015-07-13 11:38, Marc Kleine-Budde wrote:
> On 07/13/2015 11:26 AM, Manfred Schlaegl wrote:
>> I've tested this in my original situation on i.MX6Q so I can give a
>>
>> Tested-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
> 
> Thanks. The patch is already upstream so I cannot add your Tested-by.
> 
> Marc
> 
Ok ... I thought as much. Sorry for the lateness.


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

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

* Re: [PATCH RFC] can: replace timestamp as unique skb attribute
  2015-07-13  9:40     ` Manfred Schlaegl
@ 2015-07-13  9:42       ` Marc Kleine-Budde
  0 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2015-07-13  9:42 UTC (permalink / raw)
  To: Manfred Schlaegl, Oliver Hartkopp, linux-can; +Cc: tom_usenet, s.grosjean

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

On 07/13/2015 11:40 AM, Manfred Schlaegl wrote:
> On 2015-07-13 11:38, Marc Kleine-Budde wrote:
>> On 07/13/2015 11:26 AM, Manfred Schlaegl wrote:
>>> I've tested this in my original situation on i.MX6Q so I can give a
>>>
>>> Tested-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
>>
>> Thanks. The patch is already upstream so I cannot add your Tested-by.
>>
>> Marc
>>
> Ok ... I thought as much. Sorry for the lateness.

No problem - thanks for testing which is really important!

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: 455 bytes --]

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

end of thread, other threads:[~2015-07-13  9:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-26  9:58 [PATCH RFC] can: replace timestamp as unique skb attribute Oliver Hartkopp
2015-07-01  8:01 ` Marc Kleine-Budde
2015-07-04 16:00   ` Oliver Hartkopp
2015-07-13  9:26 ` Manfred Schlaegl
2015-07-13  9:38   ` Marc Kleine-Budde
2015-07-13  9:40     ` Manfred Schlaegl
2015-07-13  9:42       ` 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).