Thread (9 messages) 9 messages, 5 authors, 2023-06-07

Re: [PATCH v3] hv_netvsc: Allocate rx indirection table size dynamically

From: Christophe JAILLET <hidden>
Date: 2023-05-29 14:25:24
Also in: lkml, netdev

Le 29/05/2023 à 15:30, Shradha Gupta a écrit :
Thanks for the comment Christophe.
On Mon, May 29, 2023 at 02:49:15PM +0200, Christophe JAILLET wrote:
quoted
Le 26/05/2023 ?? 08:02, Shradha Gupta a ??crit??:
quoted
Allocate the size of rx indirection table dynamically in netvsc
from the value of size provided by OID_GEN_RECEIVE_SCALE_CAPABILITIES
query instead of using a constant value of ITAB_NUM.

Signed-off-by: Shradha Gupta <redacted>
Tested-on: Ubuntu22 (azure VM, SKU size: Standard_F72s_v2)
Testcases:
1. ethtool -x eth0 output
2. LISA testcase:PERF-NETWORK-TCP-THROUGHPUT-MULTICONNECTION-NTTTCP-Synthetic
3. LISA testcase:PERF-NETWORK-TCP-THROUGHPUT-MULTICONNECTION-NTTTCP-SRIOV

---
[...]
quoted
@@ -1596,11 +1608,18 @@ void rndis_filter_device_remove(struct hv_device *dev,
  				struct netvsc_device *net_dev)
  {
  	struct rndis_device *rndis_dev = net_dev->extension;
+	struct net_device *net = hv_get_drvdata(dev);
+	struct net_device_context *ndc = netdev_priv(net);
  	/* Halt and release the rndis device */
  	rndis_filter_halt_device(net_dev, rndis_dev);
  	netvsc_device_remove(dev);
+
+	ndc->rx_table_sz = 0;
+	kfree(ndc->rx_table);
+	ndc->rx_table = NULL;
+
Nit: useless empty NL
This is to prevent any potential double free, or accessing freed memory, etc.
As requested by Haiyang in v2 patch
Setting ndc->rx_table to NULL is fine, but there is a useless *newline* 
(NL) just after.
If you have to send a v4, you can save a line of code.

CJ
quoted
quoted
  }
  int rndis_filter_open(struct netvsc_device *nvdev)
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help