-
Notifications
You must be signed in to change notification settings - Fork 620
Add CSI FW & Driver implementations #7045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
pillip8282
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| @@ -0,0 +1,17 @@ | |||
| UTC_TYPE=CHECK | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this supported in public build?
| # | ||
| # CONFIG_EXAMPLES_TAHI is not set | ||
| CONFIG_EXAMPLES_WIFIMANAGER_TEST=y | ||
| # CONFIG_EXAMPLES_WIFIMANAGER_TEST is not set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can avoid this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enabling this config is causing build error. So did this change to go ahead and fix the wifi manager issue separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's resolve build error and avoid changes apart from CSI. Please check in all build config files.
| @@ -0,0 +1,276 @@ | |||
| /**************************************************************************** | |||
| * | |||
| * Copyright 2024 Samsung Electronics All Rights Reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2024 -> 2025
ca01ba7 to
445febd
Compare
| CONFIG_WIFI_CSI_RTL8730E=y | ||
| CONFIG_CSIFW=y | ||
| # CONFIG_CSIFW_LOGS is not set | ||
| # CONFIG_CSIFW_LOGE is not set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep error logs always ON
| if (sockfd >= 0) { | ||
| struct ifreq req; | ||
| if (strlen(ifname) >= IFNAMSIZ) { | ||
| return ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may require close(sockfd) before return.
| int start_csi_framework(csifw_context_t *p_ctx) | ||
| { | ||
|
|
||
| if (!p_ctx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start_csi_framework is an internal API. The caller of this API has already checked 'csifw_context_t', is it really required to check in every function call.
| int csifw_task_Main(int argc, char *argv[]) | ||
| { | ||
|
|
||
| csifw_context_t *p_csifw_ctx = get_csifw_context(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not good.
static csifw_context_t *g_pcsifw_context = NULL;
static means this should not be referenced outside the file of declaration. However, get_csifw_context is a kind of backdoor access to this function.
either remove static from g_pcsifw_context, then you can access it without any function call.
OR
change implementation to not use it outside the file of declaration
| # | ||
| # CONFIG_EXAMPLES_TAHI is not set | ||
| CONFIG_EXAMPLES_WIFIMANAGER_TEST=y | ||
| # CONFIG_EXAMPLES_WIFIMANAGER_TEST is not set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's resolve build error and avoid changes apart from CSI. Please check in all build config files.
|
|
||
| #ifdef __cplusplus /* If this is a C++ compiler, end C linkage */ | ||
| } | ||
| #endif No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an empty line at end of file is guideline. please check all files
| @@ -0,0 +1,17 @@ | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may remove this code. Automated utc is not supported in this repo.
|
|
||
| if (!p_ctx) { | ||
| CSIFW_LOGE("Invalid context pointer (NULL)"); | ||
| return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at all other places, you are returning 0 as success and a -ve or +ve number as failure. Please follow same practice
| { | ||
|
|
||
| csifw_context_t *p_csifw_ctx = get_csifw_context(); | ||
| //p_csifw_ctx is checked for null in start_csi_framework(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for such comments
framework/src/csimanager/inc/csifw.h
Outdated
| struct icmp_echo_hdr *p_iecho; /* Echo Header */ | ||
| struct sockaddr *socketAddr; /* Sokcet Address */ | ||
| pthread_t csi_ping_thread; /* CSI Ping Thread */ | ||
| struct addrinfo *result; /* Address Information */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'result' what does this mean?
Please use a better name which explain the purpose of this member variable.
| return CSIFW_ERROR; | ||
| } | ||
|
|
||
| *socketAddr = rp->ai_addr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 316 & 320, Code reached this point considering socket API is successful.
is it possible 316 and 320 can fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*socketAddr and (*socketAddr)->sa_family
are checked as their validity were not checked earlier.
Although rp is checked for NULL but ai_addr and sa_family can not be left unchecked.
| break; | ||
| } | ||
| } | ||
| CSIFW_LOGD("Using socket %d for ping operations", *ping_socket); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
socket is created, hence in all failure cases in this function it should be closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of failure/error
CSIFrameworkMain.c -> csifw_task_Main() handles the closing and resource cleaning.
| tv.tv_sec = 1; | ||
| tv.tv_usec = 0; | ||
|
|
||
| if (setsockopt(*ping_socket, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, sizeof(struct timeval)) != ERR_OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why RCV_TIMEOUT is set to 1 second here?
We are sending ping every few milliseconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used the setsockopt() arguments same as it is used at other places.
framework/src/csimanager/inc/csifw.h
Outdated
|
|
||
| unsigned char *get_data_buffptr; /* Buffer to get data from driver */ | ||
| unsigned int task_run_success; /* Track if csifw_task initialization */ | ||
| unsigned int data_receiver_fd; /* Value from OPEN Driver */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it unsigned int, when using you are copying this in an int variable?
Can we not use it as int directly?
|
Please improve commit messages and PR description & mention the actual implementation being added. |
This commit establishes the foundational driver support for the CSI (Channel State Information) Framework. Key Changes: - Add CSI Framework configuration menu to os/Kconfig - Enable CONFIG_WIFI_CSI and CONFIG_CSIFW across all RTL8730E build configurations - Add RTL8730E CSI driver (rtl8730e_rtk_csi.c) to board build system - Update netlib headers to support CSI device operations - Configure CSI device path (/dev/wificsi) in defconfig files - Establishes framework for both HT and non-HT CSI data types
4f402c1 to
e5b0ef5
Compare
This commit implements the core CSI Framework management layer with comprehensive API and functionality: - Complete CSI Framework API (csifw_api.h) with service management functions - Core framework components: CSIManager, CSIPacketReceiver, CSINetworkMonitor, PingGenerator, CSIFrameworkMain - Service lifecycle management (register, start, stop, unregister) - Support for multiple CSI data types (HT_CSI_DATA, NON_HT_CSI_DATA, etc.) - Callback-based data delivery (raw and parsed data) - Network monitoring and automatic connection handling - Thread-safe operations with mutex protection API Features: - Service registration with configurable callbacks (raw/parsed data) - Multi-service support (up to 3 concurrent services) - Configurable data collection intervals - Automatic WiFi connection monitoring and recovery - Thread-safe operations with comprehensive error handling - Support for HT and non-HT CSI data types
This commit adds comprehensive sample applications demonstrating CSI Framework usage: Applications Added: - csifw_sample: Full-featured sample application with CLI interface - csifw_test: Framework validation and testing application csifw_sample Features: - Command-line interface with comprehensive parameter validation - Support for all CSI data types (HT_CSI_DATA, NON_HT_CSI_DATA, etc.) - Configurable callback types (raw data, parsed data, or both) - Adjustable data collection intervals (30ms minimum) - Configurable run duration for automated testing - Detailed usage documentation and examples Build Integration: - Added to apps/examples with complete Kconfig integration - Configurable via CONFIG_EXAMPLES_CSIFW_SAMPLE and CONFIG_EXAMPLES_CSIFW_TEST - Includes comprehensive README with usage examples and technical details
No description provided.