From c4f5b14f2b384c0005a6e554b3ef1070ebee05c4 Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Mon, 25 Jan 2021 01:18:03 -0800 Subject: [PATCH] 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: Jack Pham --- drivers/usb/gadget/function/f_gsi.c | 14 +------------- drivers/usb/gadget/function/f_gsi.h | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c index c5715ff437a9..d576a220c828 100644 --- a/drivers/usb/gadget/function/f_gsi.c +++ b/drivers/usb/gadget/function/f_gsi.c @@ -1,6 +1,6 @@ // 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 @@ -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); diff --git a/drivers/usb/gadget/function/f_gsi.h b/drivers/usb/gadget/function/f_gsi.h index 0a63549d59fa..8b809d889b90 100644 --- a/drivers/usb/gadget/function/f_gsi.h +++ b/drivers/usb/gadget/function/f_gsi.h @@ -1,6 +1,6 @@ /* 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