Skip to content

Conversation

@dalvinder-s
Copy link

No description provided.

pillip8282
pillip8282 previously approved these changes Nov 18, 2025
Copy link
Contributor

@pillip8282 pillip8282 left a 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
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Author

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

Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2024 -> 2025

@rajat-samsung rajat-samsung force-pushed the master branch 5 times, most recently from ca01ba7 to 445febd Compare December 22, 2025 11:26
CONFIG_WIFI_CSI_RTL8730E=y
CONFIG_CSIFW=y
# CONFIG_CSIFW_LOGS is not set
# CONFIG_CSIFW_LOGE is not set
Copy link
Contributor

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;
Copy link
Contributor

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) {
Copy link
Contributor

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();
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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 @@

Copy link
Contributor

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;
Copy link
Contributor

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().
Copy link
Contributor

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

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 */
Copy link
Contributor

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;
Copy link
Contributor

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

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);
Copy link
Contributor

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.

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) {
Copy link
Contributor

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.

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.


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 */
Copy link
Contributor

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?

@vibhor-m vibhor-m changed the title Publish CSIFW code to openSource Add CSI FW & Driver implementations Jan 5, 2026
@vibhor-m
Copy link
Contributor

vibhor-m commented Jan 5, 2026

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
@rajat-samsung rajat-samsung force-pushed the master branch 4 times, most recently from 4f402c1 to e5b0ef5 Compare January 8, 2026 10:22
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants