1 /* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions 5 * are met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above copyright 9 * notice, this list of conditions and the following disclaimer in 10 * the documentation and/or other materials provided with the 11 * distribution. 12 * * Neither the name of The Linux Foundation nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef __WIFI_HAL_TCP_PARAM_UPDATE_COMMAND_H__ 30 #define __WIFI_HAL_TCP_PARAM_UPDATE_COMMAND_H__ 31 32 #include "cpp_bindings.h" 33 #include "common.h" 34 #include <errno.h> 35 36 #define SIZE_TCP_PARAM 100 37 #ifdef __cplusplus 38 extern "C" 39 { 40 #endif /* __cplusplus */ 41 42 /* Indicates the direction of throughput in which the change is being 43 * reported. u8 attribute. Value is 0 for TX and 1 for RX. 44 */ 45 typedef enum { 46 TP_CHANGE_TX = 0, 47 TP_CHANGE_RX = 1 48 } TpChangeDirection; 49 50 wifi_error wlan_service_update_sys_param(const char *path, const char *str); 51 wifi_error wlan_service_read_sys_param(const char *path, char *str, size_t max_size); 52 void cleanupTCPParamCommand(hal_info *info); 53 54 class TCPParamCommand: public WifiVendorCommand 55 { 56 private: 57 TCPParamCommand(wifi_handle handle, int id, u32 vendor_id, u32 subcmd); 58 int wlan_service_set_tcp_adv_win_scale(char *str); 59 int wlan_service_set_tcp_use_userconfig(const char *str); 60 int wlan_service_set_tcp_delack_seg(char *str); 61 int wlan_service_set_tcp_limit_output_bytes(char *str); 62 63 public: 64 virtual ~TCPParamCommand(); 65 static TCPParamCommand *instance(wifi_handle handle, 66 wifi_request_id id); 67 virtual int handleEvent(WifiEvent &event); 68 char def_tcp_limit_output_bytes[SIZE_TCP_PARAM]; 69 bool def_tcp_limit_output_bytes_valid; 70 char def_tcp_adv_win_scale[SIZE_TCP_PARAM]; 71 bool def_tcp_adv_win_scale_valid; 72 }; 73 74 /* Used to clean TCPParam object*/ 75 typedef struct tcp_param_cmd_handler_s { 76 TCPParamCommand *tcpParamCommand; 77 } tcp_param_cmd_handler; 78 #ifdef __cplusplus 79 } 80 #endif /* __cplusplus */ 81 #endif 82