On Thu, Mar 07, 2024 at 11:12:07PM +0530, Krishna Kurapati PSSNV wrote:
I believe using gether_cleanup altogether may not be an optimal solution.
The creation and deletion of network interfaces should align with the behavior of each specific network driver.
For instance, in the case of NCM, the usb0 interface is created upon the creation of a directory
in config/usb_gadget/gX/functions/ncm.usb0, and it is removed when the corresponding directory
is deleted. This follows a standard flow observed in many network drivers, where interfaces are
created during driver loading/probing and deleted during removal.
Typically, deleting the gadget on every disconnection is not considered a good practice, as it can
negatively impact the user experience when accessing the gadget.
In our specific scenario, retaining the usb0 network interface has proven to enhance performance
and stabilize connections. Previous attempts to remove it resulted in an observed increase in time of 300ms,
particularly at the start of Apple CarPlay sessions.
Furthermore, it's important to highlight that in Qualcomm products and msm kernels, the inclusion of gether_cleanup
in the unbind process was eventually reverted. While the specific reason for reverting the patch is unknown,
it suggests that the addition may not have yielded the intended or required results
Following is the revert patch details in msm-5.4 kernel, if you want check it.
Revert "usb: gadget: f_ncm: allocate/free net device upon driver bind/unbind"
This reverts commit 006d8adf555a8c6d34113f564ade312d68abd3b3.
Move back the allocation of netdevice to alloc_inst(), one-time
registration to bind(), deregistration and free to rm_inst(). The
UI update issue will be taken up with proper stakeholders.
Change-Id: I56448b08f6796a43ec5b0dfe0dd2d42cdc0eec14