  		macoff = netoff - maclen;
  	}
  
-@@ -741,6 +768,24 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
+@@ -741,6 +768,16 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
  
  	skb_copy_bits(skb, 0, h.raw + macoff, snaplen);
  
 +#ifdef CONFIG_FFCLOCK
-+	  /* Provide a timeval stamp build based on the FFclock or a timestamp
-+	   * for fair comparison. Replace existing timestamp in the skbuff if in
-+	   * the right mode. Default is to return normal stamp.
-+	   */
++	  /* Provide a timeval stamp build based on the FFClock */
 +	switch (sk->sk_ffclock_tsmode) {
 +	case FFCLOCK_TSMODE_FFCLOCK:
 +		ffcounter_to_ktime(&skb->ffclock_stamp, &ffclock_ktime);
 +		skb->tstamp = ffclock_ktime;
 +		break;
-+/*
-+	case FFCLOCK_TSMODE_FAIRCOMPARE:
-+		skb->tstamp = skb->tstamp_fair;
-+		break;
-+*/
 +	}
 +#endif /* CONFIG_FFCLOCK */
 +
  	switch (po->tp_version) {
  	case TPACKET_V1:
  		h.h1->tp_len = skb->len;
-@@ -784,6 +829,34 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
+@@ -784,6 +821,34 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
  	else
  		sll->sll_ifindex = dev->ifindex;
  

 	__packet_set_status(po, h.raw, status);
 	smp_mb();
 	{
@@ -1119,6 +1192,15 @@ static int packet_snd(struct socket *sock,
 	if (err)
 		goto out_free;
 
+#ifdef CONFIG_FFCLOCK
+	/* Pass the two extra raw timestamps specific to the FFCLOCK to the
+	 * socket: the raw ffcounter and the timeval stamps used in the
+	 * FFCLOCK_TSMODE_FAIRCOMPARE mode.
+	 */
+	sk->sk_ffclock_stamp = skb->ffclock_stamp;
+	sk->sk_stamp_fair = skb->tstamp_fair;
+#endif /* CONFIG_FFCLOCK */
+
 	skb->protocol = proto;
 	skb->dev = dev;
 	skb->priority = sk->sk_priority;
@@ -1472,6 +1554,14 @@ static int packet_recvmsg(struct kiocb *iocb, struct socket *sock,
 	if (err)
 		goto out_free;
 
+#ifdef CONFIG_FFCLOCK
+	/* Pass the two extra raw timestamps specific to the FFCLOCK to the
+	 * socket: the raw ffcounter and the timeval stamps used in the
+	 * FFCLOCK_TSMODE_FAIRCOMPARE mode.
+	 */
+	sk->sk_ffclock_stamp = skb->ffclock_stamp;
+	sk->sk_stamp_fair = skb->tstamp_fair;
+#endif
 	sock_recv_timestamp(msg, sk, skb);
 
 	if (msg->msg_name)
@@ -1979,6 +2069,10 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
 {
 	struct sock *sk = sock->sk;
 

+#ifdef CONFIG_FFCLOCK
+static int rw_long_long(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	mm_segment_t old_fs = get_fs();
+	u64 __user *argptr = compat_ptr(arg);
+	int err;
+	__u64 val;
+
+	if (get_user(val, argptr))
+		return -EFAULT;
