i40iw: Account for IPv6 header when setting MSS
authorShiraz Saleem <shiraz.saleem@intel.com>
Mon, 16 Oct 2017 20:45:59 +0000 (15:45 -0500)
committerDoug Ledford <dledford@redhat.com>
Wed, 18 Oct 2017 17:28:46 +0000 (13:28 -0400)
The IPv6 header size is not subtracted from MTU when MSS is
set for QPs.

Save MTU opposed to MSS in the vsi struct during
initialization and calculate the MSS based on IPv4 vs
IPv6 connection.

Fixes: f27b4746f378 ("i40iw: add connection management code")
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/i40iw/i40iw.h
drivers/infiniband/hw/i40iw/i40iw_cm.c
drivers/infiniband/hw/i40iw/i40iw_ctrl.c
drivers/infiniband/hw/i40iw/i40iw_d.h
drivers/infiniband/hw/i40iw/i40iw_main.c
drivers/infiniband/hw/i40iw/i40iw_puda.c
drivers/infiniband/hw/i40iw/i40iw_type.h

index a65e4cbdce2f6ad336d58a226e84ac35fc7f7eda..4ae9131b6350909b73b0f863793f32f104d5febd 100644 (file)
 #define I40IW_CQP_COMPL_SQ_WQE_FLUSHED    3
 #define I40IW_CQP_COMPL_RQ_SQ_WQE_FLUSHED 4
 
-#define I40IW_MTU_TO_MSS               40
-#define I40IW_DEFAULT_MSS              1460
-
 struct i40iw_cqp_compl_info {
        u32 op_ret_val;
        u16 maj_err_code;
index 4bd54b3675322579cc95b7559b55aae16f8c9b9d..493d6ef3d2d57e4f1e020fd680ab4fc009f8cb7e 100644 (file)
@@ -2193,7 +2193,8 @@ static struct i40iw_cm_node *i40iw_make_cm_node(
                        I40IW_CM_DEFAULT_RCV_WND_SCALED >> I40IW_CM_DEFAULT_RCV_WND_SCALE;
        ts = current_kernel_time();
        cm_node->tcp_cntxt.loc_seq_num = ts.tv_nsec;
-       cm_node->tcp_cntxt.mss = iwdev->vsi.mss;
+       cm_node->tcp_cntxt.mss = (cm_node->ipv4) ? (iwdev->vsi.mtu - I40IW_MTU_TO_MSS_IPV4) :
+                                (iwdev->vsi.mtu - I40IW_MTU_TO_MSS_IPV6);
 
        cm_node->iwdev = iwdev;
        cm_node->dev = &iwdev->sc_dev;
index a3ea42888576d68a27488af118774de4668e020b..fbc0f95b0ebd70b04802325e6801fdbcbc040e5f 100644 (file)
@@ -348,7 +348,7 @@ void i40iw_change_l2params(struct i40iw_sc_vsi *vsi, struct i40iw_l2params *l2pa
        u16 qs_handle;
        int i;
 
-       vsi->mss = l2params->mss;
+       vsi->mtu = l2params->mtu;
 
        i40iw_fill_qos_list(l2params->qs_handle_list);
        for (i = 0; i < I40IW_MAX_USER_PRIORITY; i++) {
@@ -4582,9 +4582,8 @@ void i40iw_sc_vsi_init(struct i40iw_sc_vsi *vsi, struct i40iw_vsi_init_info *inf
 
        vsi->dev = info->dev;
        vsi->back_vsi = info->back_vsi;
-       vsi->mss = info->params->mss;
+       vsi->mtu = info->params->mtu;
        vsi->exception_lan_queue = info->exception_lan_queue;
-
        i40iw_fill_qos_list(info->params->qs_handle_list);
 
        for (i = 0; i < I40IW_MAX_USER_PRIORITY; i++) {
index 40d474384a4e87e15a11aa903a944902e8fc0c1a..17ed45b42df4bde0f46cd79d20b4721e0c82dbef 100644 (file)
 #define I40IW_FIRST_NON_PF_STAT        4
 
 
+#define I40IW_MTU_TO_MSS_IPV4          40
+#define I40IW_MTU_TO_MSS_IPV6          60
+#define I40IW_DEFAULT_MTU              1500
+
 #define LS_64_1(val, bits)      ((u64)(uintptr_t)val << bits)
 #define RS_64_1(val, bits)      ((u64)(uintptr_t)val >> bits)
 #define LS_32_1(val, bits)      (u32)(val << bits)
index ee0323fe765d6dc3cbaa3ab7afd3b3411dcbe924..438f5269548b25514d27e9725424d7b40b99994e 100644 (file)
@@ -1327,8 +1327,8 @@ static enum i40iw_status_code i40iw_initialize_dev(struct i40iw_device *iwdev,
        info.bar0 = ldev->hw_addr;
        info.hw = &iwdev->hw;
        info.debug_mask = debug;
-       l2params.mss =
-               (ldev->params.mtu) ? ldev->params.mtu - I40IW_MTU_TO_MSS : I40IW_DEFAULT_MSS;
+       l2params.mtu =
+               (ldev->params.mtu) ? ldev->params.mtu : I40IW_DEFAULT_MTU;
        for (i = 0; i < I40E_CLIENT_MAX_USER_PRIORITY; i++) {
                qset = ldev->params.qos.prio_qos[i].qs_handle;
                l2params.qs_handle_list[i] = qset;
@@ -1748,7 +1748,7 @@ static void i40iw_l2param_change(struct i40e_info *ldev, struct i40e_client *cli
        for (i = 0; i < I40E_CLIENT_MAX_USER_PRIORITY; i++)
                l2params->qs_handle_list[i] = params->qos.prio_qos[i].qs_handle;
 
-       l2params->mss = (params->mtu) ? params->mtu - I40IW_MTU_TO_MSS : iwdev->vsi.mss;
+       l2params->mtu = (params->mtu) ? params->mtu : iwdev->vsi.mtu;
 
        INIT_WORK(&work->work, i40iw_l2params_worker);
        queue_work(iwdev->param_wq, &work->work);
index dfbade0ad003a17fe5846f6d22c3fce1575ab25e..af6d0dc82b8935400e6eeb28d45204f0d9773c75 100644 (file)
@@ -1401,7 +1401,8 @@ static void i40iw_ieq_handle_exception(struct i40iw_puda_rsrc *ieq,
                pfpdu->rcv_nxt = fps;
                pfpdu->fps = fps;
                pfpdu->mode = true;
-               pfpdu->max_fpdu_data = ieq->vsi->mss;
+               pfpdu->max_fpdu_data = (buf->ipv4) ? (ieq->vsi->mtu - I40IW_MTU_TO_MSS_IPV4) :
+                                      (ieq->vsi->mtu - I40IW_MTU_TO_MSS_IPV6);
                pfpdu->pmode_count++;
                INIT_LIST_HEAD(rxlist);
                i40iw_ieq_check_first_buf(buf, fps);
index e8d153b963ec29ffdcbc1caa78d8ec416aac50de..f443f2075d6f4c5a02aa84ca82363a62c8f577a5 100644 (file)
@@ -460,7 +460,7 @@ struct i40iw_sc_vsi {
        struct i40iw_virt_mem ieq_mem;
        struct i40iw_puda_rsrc *ieq;
        u16 exception_lan_queue;
-       u16 mss;
+       u16 mtu;
        u8 fcn_id;
        bool stats_fcn_id_alloc;
        struct i40iw_qos qos[I40IW_MAX_USER_PRIORITY];
@@ -566,7 +566,7 @@ struct i40iw_ccq_cqe_info {
 
 struct i40iw_l2params {
        u16 qs_handle_list[I40IW_MAX_USER_PRIORITY];
-       u16 mss;
+       u16 mtu;
 };
 
 struct i40iw_vsi_init_info {