[1/4] netvsc: chimney buffer size error handling

Message ID 20180809175008.5787-2-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series netvsc performance enhancements |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Stephen Hemminger Aug. 9, 2018, 5:50 p.m. UTC
  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.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/net/netvsc/hn_nvs.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
  

Comments

Ferruh Yigit Aug. 23, 2018, 2:45 p.m. UTC | #1
On 8/9/2018 6:50 PM, Stephen Hemminger wrote:
> 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.
> 
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>

subsytem is net/netvsc, so title should be:
net/netvsc: fix chimney buffer size error handling

Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org

Assuming you want patch to be backported.

I will update as above while merging.
  
Stephen Hemminger Aug. 23, 2018, 3:38 p.m. UTC | #2
On Thu, 23 Aug 2018 15:45:17 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 8/9/2018 6:50 PM, Stephen Hemminger wrote:
> > 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.
> > 
> > Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>  
> 
> subsytem is net/netvsc, so title should be:
> net/netvsc: fix chimney buffer size error handling
> 
> Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
> Cc: stable@dpdk.org
> 
> Assuming you want patch to be backported.
> 
> I will update as above while merging.

There is not a high urgency to back port this. If chimney buffer setup
fails the driver is unusable anyway. It is more of a theoretical error condition.
  

Patch

diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 77d3b839fd45..a458bb720f82 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -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;