Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4f5b14f authored by Jack Pham's avatar Jack Pham
Browse files

usb: f_gsi: Clean up low memory buffer size/depth definitions



Move the #ifdef CONFIG_USB_LOW_MEM_VARIANT conditionals from
to the f_gsi.h header and simplify the usages in the code to
use a single set of #defines.

Also add a redefinition of the ADPL buffer depth to 15 in
case of low memory variant.

Change-Id: I138ec69effd5ef38a6de95b8ce6a1f356d6079bb
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 8644c963
Loading
Loading
Loading
Loading
+1 −13
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
@@ -2897,15 +2897,9 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f)
		info.ss_desc_hdr = gsi_eth_ss_function;
		info.in_epname = "gsi-epin";
		info.out_epname = "gsi-epout";
#ifdef CONFIG_USB_LOW_MEM_VARIANT
		info.in_req_buf_len = GSI_IN_BUFF_SIZE;
		gsi->d_port.in_aggr_size = GSI_IN_LOW_MEM_RNDIS_AGGR_SIZE;
		info.in_req_num_buf = GSI_NUM_IN_BUFFERS;
#else
		info.in_req_buf_len = GSI_IN_RNDIS_BUFF_SIZE;
		gsi->d_port.in_aggr_size = GSI_IN_RNDIS_AGGR_SIZE;
		info.in_req_num_buf = GSI_NUM_IN_RNDIS_BUFFERS;
#endif
		gsi->d_port.out_aggr_size = GSI_OUT_AGGR_SIZE;
		info.out_req_buf_len = GSI_OUT_AGGR_SIZE;
		info.out_req_num_buf = GSI_NUM_OUT_BUFFERS;
@@ -3079,15 +3073,9 @@ static int gsi_bind(struct usb_configuration *c, struct usb_function *f)
		info.in_epname = "gsi-epin";
		info.out_epname = "gsi-epout";
		gsi->d_port.in_aggr_size = GSI_IN_RMNET_AGGR_SIZE;
#ifdef CONFIG_USB_LOW_MEM_VARIANT
		info.in_req_buf_len = GSI_IN_BUFF_SIZE;
		info.in_req_num_buf = GSI_NUM_IN_BUFFERS;
		info.out_req_buf_len = GSI_OUT_LOW_MEM_RMNET_BUF_LEN;
#else
		info.in_req_buf_len = GSI_IN_RMNET_BUFF_SIZE;
		info.in_req_num_buf = GSI_NUM_IN_RMNET_BUFFERS;
		info.out_req_buf_len = GSI_OUT_RMNET_BUF_LEN;
#endif
		gsi->d_port.out_aggr_size = GSI_OUT_AGGR_SIZE;
		info.out_req_num_buf = GSI_NUM_OUT_BUFFERS;
		info.notify_buf_len = sizeof(struct usb_cdc_notification);
+19 −3
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
 */

#ifndef _F_GSI_H
@@ -45,8 +45,24 @@
#define GSI_IN_RMNET_AGGR_SIZE 16384
#define GSI_ECM_AGGR_SIZE 2048

#define GSI_IN_LOW_MEM_RNDIS_AGGR_SIZE 9216
#define GSI_OUT_LOW_MEM_RMNET_BUF_LEN 16384
#ifdef CONFIG_USB_LOW_MEM_VARIANT
# undef  GSI_IN_RNDIS_BUFF_SIZE
# define GSI_IN_RNDIS_BUFF_SIZE GSI_IN_BUFF_SIZE
# undef  GSI_IN_RNDIS_AGGR_SIZE
# define GSI_IN_RNDIS_AGGR_SIZE 9216
# undef  GSI_NUM_IN_RNDIS_BUFFERS
# define GSI_NUM_IN_RNDIS_BUFFERS GSI_NUM_IN_BUFFERS

# undef  GSI_IN_RMNET_BUFF_SIZE
# define GSI_IN_RMNET_BUFF_SIZE GSI_IN_BUFF_SIZE
# undef  GSI_NUM_IN_RMNET_BUFFERS
# define GSI_NUM_IN_RMNET_BUFFERS GSI_NUM_IN_BUFFERS
# undef  GSI_OUT_RMNET_BUF_LEN
# define GSI_OUT_RMNET_BUF_LEN 16384

# undef  GSI_NUM_IN_DPL_BUFFERS
# define GSI_NUM_IN_DPL_BUFFERS 15
#endif

#define GSI_OUT_MBIM_BUF_LEN 16384
#define GSI_OUT_RMNET_BUF_LEN 31744