net/netvsc: fix chimney buffer size error handling
authorStephen Hemminger <sthemmin@microsoft.com>
Thu, 9 Aug 2018 17:50:05 +0000 (10:50 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 28 Aug 2018 13:27:39 +0000 (15:27 +0200)
Fix the error handling in setting up transmit buffer.
If setting up chimney buffer fails, then it is not connected so
no need to send disconnect.

Allow for some unused area if full area is not used.

Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
drivers/net/netvsc/hn_nvs.c

index 77d3b83..a458bb7 100644 (file)
@@ -279,14 +279,13 @@ hn_nvs_conn_chim(struct hn_data *hv)
                               NVS_TYPE_CHIM_CONNRESP);
        if (error) {
                PMD_DRV_LOG(ERR, "exec nvs chim conn failed");
-               goto cleanup;
+               return error;
        }
 
        if (resp.status != NVS_STATUS_OK) {
                PMD_DRV_LOG(ERR, "nvs chim conn failed: %x",
                            resp.status);
-               error = -EIO;
-               goto cleanup;
+               return -EIO;
        }
 
        sectsz = resp.sectsz;
@@ -295,7 +294,8 @@ hn_nvs_conn_chim(struct hn_data *hv)
                PMD_DRV_LOG(NOTICE,
                            "invalid chimney sending buffer section size: %u",
                            sectsz);
-               return 0;
+               error = -EINVAL;
+               goto cleanup;
        }
 
        hv->chim_szmax = sectsz;
@@ -304,11 +304,6 @@ hn_nvs_conn_chim(struct hn_data *hv)
        PMD_DRV_LOG(INFO, "send buffer %lu section size:%u, count:%u",
                    len, hv->chim_szmax, hv->chim_cnt);
 
-       if (len % hv->chim_szmax != 0) {
-               PMD_DRV_LOG(NOTICE,
-                           "chimney sending sections are not properly aligned");
-       }
-
        /* Done! */
        return 0;