NFC: llcp: Rename socket rw and miu fields
authorSamuel Ortiz <sameo@linux.intel.com>
Fri, 22 Feb 2013 00:12:28 +0000 (01:12 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 10 Mar 2013 21:20:05 +0000 (22:20 +0100)
They really are remote peer parameters, and we need to distinguish them
from the local ones as we'll modify the latter with socket options.

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

index c6bc3bd950526ee2de42426337e74962e6181deb..c8a2096657926deae32f7333050bc571519d5da0 100644 (file)
@@ -184,10 +184,10 @@ int nfc_llcp_parse_connection_tlv(struct nfc_llcp_sock *sock,
 
                switch (type) {
                case LLCP_TLV_MIUX:
-                       sock->miu = llcp_tlv_miux(tlv) + 128;
+                       sock->remote_miu = llcp_tlv_miux(tlv) + 128;
                        break;
                case LLCP_TLV_RW:
-                       sock->rw = llcp_tlv_rw(tlv);
+                       sock->remote_rw = llcp_tlv_rw(tlv);
                        break;
                case LLCP_TLV_SN:
                        break;
@@ -200,7 +200,8 @@ int nfc_llcp_parse_connection_tlv(struct nfc_llcp_sock *sock,
                tlv += length + 2;
        }
 
-       pr_debug("sock %p rw %d miu %d\n", sock, sock->rw, sock->miu);
+       pr_debug("sock %p rw %d miu %d\n", sock,
+                sock->remote_rw, sock->remote_miu);
 
        return 0;
 }
@@ -532,8 +533,8 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
 
        /* Remote is ready but has not acknowledged our frames */
        if((sock->remote_ready &&
-           skb_queue_len(&sock->tx_pending_queue) >= sock->rw &&
-           skb_queue_len(&sock->tx_queue) >= 2 * sock->rw)) {
+           skb_queue_len(&sock->tx_pending_queue) >= sock->remote_rw &&
+           skb_queue_len(&sock->tx_queue) >= 2 * sock->remote_rw)) {
                pr_err("Pending queue is full %d frames\n",
                       skb_queue_len(&sock->tx_pending_queue));
                return -ENOBUFS;
@@ -541,7 +542,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
 
        /* Remote is not ready and we've been queueing enough frames */
        if ((!sock->remote_ready &&
-            skb_queue_len(&sock->tx_queue) >= 2 * sock->rw)) {
+            skb_queue_len(&sock->tx_queue) >= 2 * sock->remote_rw)) {
                pr_err("Tx queue is full %d frames\n",
                       skb_queue_len(&sock->tx_queue));
                return -ENOBUFS;
@@ -561,7 +562,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
 
        while (remaining_len > 0) {
 
-               frag_len = min_t(size_t, sock->miu, remaining_len);
+               frag_len = min_t(size_t, sock->remote_miu, remaining_len);
 
                pr_debug("Fragment %zd bytes remaining %zd",
                         frag_len, remaining_len);
@@ -621,7 +622,7 @@ int nfc_llcp_send_ui_frame(struct nfc_llcp_sock *sock, u8 ssap, u8 dsap,
 
        while (remaining_len > 0) {
 
-               frag_len = min_t(size_t, sock->miu, remaining_len);
+               frag_len = min_t(size_t, sock->remote_miu, remaining_len);
 
                pr_debug("Fragment %zd bytes remaining %zd",
                         frag_len, remaining_len);
index 7f8266dd14cbc164a278aa3bbc0438c845fa0bf5..c0048b2395dd56f579ab70941dfcf3f99e3952f3 100644 (file)
@@ -865,7 +865,7 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local,
        new_sock = nfc_llcp_sock(new_sk);
        new_sock->dev = local->dev;
        new_sock->local = nfc_llcp_local_get(local);
-       new_sock->miu = local->remote_miu;
+       new_sock->remote_miu = local->remote_miu;
        new_sock->nfc_protocol = sock->nfc_protocol;
        new_sock->dsap = ssap;
        new_sock->target_idx = local->target_idx;
@@ -919,11 +919,11 @@ int nfc_llcp_queue_i_frames(struct nfc_llcp_sock *sock)
 
        pr_debug("Remote ready %d tx queue len %d remote rw %d",
                 sock->remote_ready, skb_queue_len(&sock->tx_pending_queue),
-                sock->rw);
+                sock->remote_rw);
 
        /* Try to queue some I frames for transmission */
        while (sock->remote_ready &&
-              skb_queue_len(&sock->tx_pending_queue) < sock->rw) {
+              skb_queue_len(&sock->tx_pending_queue) < sock->remote_rw) {
                struct sk_buff *pdu;
 
                pdu = skb_dequeue(&sock->tx_queue);
index 0eae5c5095047dcd449af0ddba8fd402f79f50e2..32cec81939e65c7297e1c97022b7a44291901e11 100644 (file)
@@ -104,8 +104,10 @@ struct nfc_llcp_sock {
        u8 dsap;
        char *service_name;
        size_t service_name_len;
-       u8 rw;
-       u16 miu;
+
+       /* Remote link parameters */
+       u8 remote_rw;
+       u16 remote_miu;
 
        /* Link variables */
        u8 send_n;
index 5332751943a9ec564befadda63a5a3749d7434c1..cc564992ba95bd374187befe60ed34ace126616b 100644 (file)
@@ -541,7 +541,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
 
        llcp_sock->dev = dev;
        llcp_sock->local = nfc_llcp_local_get(local);
-       llcp_sock->miu = llcp_sock->local->remote_miu;
+       llcp_sock->remote_miu = llcp_sock->local->remote_miu;
        llcp_sock->ssap = nfc_llcp_get_local_ssap(local);
        if (llcp_sock->ssap == LLCP_SAP_MAX) {
                ret = -ENOMEM;
@@ -800,8 +800,8 @@ struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp)
 
        llcp_sock->ssap = 0;
        llcp_sock->dsap = LLCP_SAP_SDP;
-       llcp_sock->rw = LLCP_DEFAULT_RW;
-       llcp_sock->miu = LLCP_DEFAULT_MIU;
+       llcp_sock->remote_rw = LLCP_DEFAULT_RW;
+       llcp_sock->remote_miu = LLCP_DEFAULT_MIU;
        llcp_sock->send_n = llcp_sock->send_ack_n = 0;
        llcp_sock->recv_n = llcp_sock->recv_ack_n = 0;
        llcp_sock->remote_ready = 1;