NFC: Add support for SO_TIMESTAMP LLCP socket option
authorThierry Escande <thierry.escande@linux.intel.com>
Tue, 27 Nov 2012 14:44:24 +0000 (15:44 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 9 Jan 2013 23:44:24 +0000 (00:44 +0100)
Set timestamp in sent and received sk_buffs. timestamp is then put in
msghdr structure in llcp_sock_recvmsg().

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
net/nfc/llcp/commands.c
net/nfc/llcp/llcp.c
net/nfc/llcp/sock.c

index df24be48d4dad2ee998bb483bdd4b1d109b24333..c6bc3bd950526ee2de42426337e74962e6181deb 100644 (file)
@@ -304,6 +304,8 @@ int nfc_llcp_send_symm(struct nfc_dev *dev)
 
        skb = llcp_add_header(skb, 0, 0, LLCP_PDU_SYMM);
 
+       __net_timestamp(skb);
+
        nfc_llcp_send_to_raw_sock(local, skb, NFC_LLCP_DIRECTION_TX);
 
        return nfc_data_exchange(dev, local->target_idx, skb,
index ec43914c92a9fbb416c5170e1d74440bb4dd1bf1..6c5971437826a7b5f0b365a956012257efaf373d 100644 (file)
@@ -668,6 +668,8 @@ static void nfc_llcp_tx_work(struct work_struct *work)
                        if (ptype == LLCP_PDU_I)
                                copy_skb = skb_copy(skb, GFP_ATOMIC);
 
+                       __net_timestamp(skb);
+
                        nfc_llcp_send_to_raw_sock(local, skb,
                                                  NFC_LLCP_DIRECTION_TX);
 
@@ -1245,6 +1247,8 @@ static void nfc_llcp_rx_work(struct work_struct *work)
                print_hex_dump(KERN_DEBUG, "LLCP Rx: ", DUMP_PREFIX_OFFSET,
                               16, 1, skb->data, skb->len, true);
 
+       __net_timestamp(skb);
+
        nfc_llcp_send_to_raw_sock(local, skb, NFC_LLCP_DIRECTION_RX);
 
        switch (ptype) {
index fea22eb41b8242a1fb80d22c6aa2ca6515d78d0e..ba1900700958a4613b06a43c035e6feedbb8e898 100644 (file)
@@ -678,6 +678,8 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
                return -EFAULT;
        }
 
+       sock_recv_timestamp(msg, sk, skb);
+
        if (sk->sk_type == SOCK_DGRAM && msg->msg_name) {
                struct nfc_llcp_ui_cb *ui_cb = nfc_llcp_ui_skb_cb(skb);
                struct sockaddr_nfc_llcp sockaddr;