i40iw: Do not retransmit MPA request after it is ACKed
authorTatyana Nikolova <tatyana.e.nikolova@intel.com>
Tue, 3 Oct 2017 16:11:46 +0000 (11:11 -0500)
committerDoug Ledford <dledford@redhat.com>
Wed, 4 Oct 2017 19:29:39 +0000 (15:29 -0400)
The ACK packets for an MPA request are ignored and
the MPA request is retransmitted if the MPA reply
is late or missing. Fix this by checking ack_rcvd
variable before retransmitting a packet.

Fixes: f27b4746f378 ("i40iw: add connection management code")
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: Faisal Latif <faisal.latif@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/i40iw/i40iw_cm.c
drivers/infiniband/hw/i40iw/i40iw_cm.h

index 9017c1cc51d47628f99781d7e7d13dafaad57949..50c43766defd2109cd5a9caa7f10cb24da76b8f0 100644 (file)
@@ -1267,13 +1267,16 @@ static void i40iw_cm_timer_tick(unsigned long pass)
                        spin_lock_irqsave(&cm_node->retrans_list_lock, flags);
                        goto done;
                }
-               cm_node->cm_core->stats_pkt_retrans++;
                spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags);
 
                vsi = &cm_node->iwdev->vsi;
                dev = cm_node->dev;
-               atomic_inc(&send_entry->sqbuf->refcount);
-               i40iw_puda_send_buf(vsi->ilq, send_entry->sqbuf);
+
+               if (!cm_node->ack_rcvd) {
+                       atomic_inc(&send_entry->sqbuf->refcount);
+                       i40iw_puda_send_buf(vsi->ilq, send_entry->sqbuf);
+                       cm_node->cm_core->stats_pkt_retrans++;
+               }
                spin_lock_irqsave(&cm_node->retrans_list_lock, flags);
                if (send_entry->send_retrans) {
                        send_entry->retranscount--;
@@ -2181,6 +2184,7 @@ static struct i40iw_cm_node *i40iw_make_cm_node(
        cm_node->cm_id = cm_info->cm_id;
        ether_addr_copy(cm_node->loc_mac, netdev->dev_addr);
        spin_lock_init(&cm_node->retrans_list_lock);
+       cm_node->ack_rcvd = false;
 
        atomic_set(&cm_node->ref_count, 1);
        /* associate our parent CM core */
@@ -2719,7 +2723,10 @@ static int i40iw_handle_ack_pkt(struct i40iw_cm_node *cm_node,
                cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq);
                if (datasize) {
                        cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize;
+                       cm_node->ack_rcvd = false;
                        i40iw_handle_rcv_mpa(cm_node, rbuf);
+               } else {
+                       cm_node->ack_rcvd = true;
                }
                break;
        case I40IW_CM_STATE_LISTENING:
index 45abef76295b24429accdce4e7a49d91dbc33cce..0d5840d2c4fc6d815e5556bbc646620a6e2a0a02 100644 (file)
@@ -360,6 +360,7 @@ struct i40iw_cm_node {
 
        u8 pdata_buf[IETF_MAX_PRIV_DATA_LEN];
        struct i40iw_kmem_info mpa_hdr;
+       bool ack_rcvd;
 };
 
 /* structure for client or CM to fill when making CM api calls. */