SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
Network bypass mode lets the user bypass the internal network stack to use their own. In this mode, all protocols above the MAC layer (such as ARP, IP, TCP/UDP, ICMP, HTTP, and so forth) are disabled and the user must implement the protocols they wish to use on the host MCU. These higher level protocols running on the host must be sent in Ethernet format.
When operating in network bypass mode, all packets are exchanged between the host and NWP as Ethernet packets. The host can send and receive Ethernet packets of up to 1514 bytes (14 bytes for headers). The host is responsible for ensuring these headers are correct because the NWP does not check. The NWP maintains the Wi-Fi connectivity, replaces Ethernet header with Wi-Fi header on transmit, and Wi-Fi header with Ethernet header on receiving. As shown in Figure 7-3, the host should include the destination MAC, source MAC, and Ethernet type as Ethernet headers plus payload.
QoS is not supported on the NWP. All packets are treated as best effort packets (for example, AC_BE).
The example below shows how to set up network bypass mode. A command is sent to the NWP to set a static IP address of 0.0.0.0, which is used to notify the NWP of network bypass mode. The internal network applications should be disabled to prevent the NWP from generating packets which could cause inconsistent behavior. Disabling the RX filter causes the NWP to forward all packets to the host. For power sensitive applications, the user should use an RX filter to prevent the host from waking up for irrelevant packets. For more information on RX filters, see Section 12.
int rc;
SlNetCfgIpV4Args_t ipAddr = {0};
SlWlanRxFilterIdMask_t FilterIdMask;
_u16 len = sizeof(SlWlanRxFilterIdMask_t);
_i16 RawPacketSD;
SlWlanSecParams_t secParams;
memset(&ipAddr, 0, sizeof(SlNetCfgIpV4Args_t));
sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE, SL_NETCFG_ADDR_STATIC, sizeof(SlNetCfgIpV4Args_t), (_u8 *)&ipAddr)
if(rc < 0){
// error setting IP address to 0.0.0.0
}
// disable network applications
rc = sl_NetAppStop(SL_NETAPP_HTTP_SERVER_ID | SL_NETAPP_DHCP_SERVER_ID | SL_NETAPP_MDNS_ID);
if(rc < 0){
// error disabling application protocols
}
// restart NWP by calling stop then start to init with static IP 0.0.0.0
rc = sl_Stop(1000);
if(rc < 0){
// error stopping NWP
}
rc = sl_Start(NULL, NULL, NULL);
if(rc < 0){
// error starting NWP
}
memset(FilterIdMask,0,sizeof(FilterIdMask));
rc = sl_WlanSet(SL_WLAN_RX_FILTERS_ID, SL_WLAN_RX_FILTER_STATE , len, (_u8* )FilterIdMask);
if(rc < 0){
// error disabling internal filter
}
// open RAW socket
RawPacketSD = sl_Socket(SL_AF_PACKET,SL_SOCK_RAW, 0);
if(RawPacketSD < 0){
// error opening raw socket
}