This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/CC3220MODA: Taking longer than expected to get IPv6 net config

Part Number: CC3220MODA


Tool/software: Code Composer Studio

I am adding IPv6 support to a battery-powered WiFi device that wakes up from hibernation mode, sends a UDP packet, and returns to hibernation mode.

This functionality is working wonderfully for IPv4 configurations; waking up and sending a UDP packet is taking less than 500ms.

For IPv6 configurations, this functionality is taking longer than I expect - more than 3 to 3.5 seconds - which is hurting the expected battery life.

Is there anything that can be done to validate the IPv6 address more quickly on via SL_IS_IPV6_ADDR_VALID?

For this application, it would be acceptable to disable DAD. Is there a way to disable DAD via the SDK or otherwise? (However, the router appears to be responding quickly to the solicitation - see the Wireshark capture.)

Could the CC3220 be put into a low power mode while the address is validating?

Proposed IPv6:

/* IPV6 */
SlNetCfgIpV6Args_t  newIPv6;
int32_t	 theSLStatus;
uint32_t ifBitmap;
uint16_t configOpt = 0;
uint16_t configLen = (Settings.IP_Mode == IP_MODE_IPV4) ?
	sizeof(SlNetCfgIpV4Args_t) : sizeof(SlNetCfgIpV6Args_t);

ifBitmap = SL_NETCFG_IF_IPV6_STA_LOCAL | SL_NETCFG_IF_IPV6_STA_GLOBAL;
theSLStatus = sl_NetCfgSet(SL_NETCFG_IF,SL_NETCFG_IF_STATE,sizeof(ifBitmap),(uint8_t *)&ifBitmap);

newIPv6.Ip[0] = Settings.Static_IPV6_Addr[0];
newIPv6.Ip[1] = Settings.Static_IPV6_Addr[1];
newIPv6.Ip[2] = Settings.Static_IPV6_Addr[2];
newIPv6.Ip[3] = Settings.Static_IPV6_Addr[3];

theSLStatus = sl_NetCfgSet(SL_NETCFG_IPV6_ADDR_LOCAL,SL_NETCFG_ADDR_STATIC,sizeof(SlNetCfgIpV6Args_t),(uint8_t *)&newIPv6);

// hibernate
// ...
// wake from hibernation

for (uint8_t i = 0; i < 20; i++)
{
	sl_NetCfgGet(SL_NETCFG_IPV6_ADDR_LOCAL,&configOpt,&configLen,(_u8 *)&newIPv6);

	// This condition appears to take several seconds to validate
	if (SL_IS_IPV6_ADDR_VALID(newIPv6.IpV6Flags))
		break;

	usleep(300 * 1000L);
}

// send packet

Working IPv4:

/* IPV4 */
SlNetCfgIpV4Args_t  newIPv4;
int32_t	 theSLStatus;
uint32_t ifBitmap;
uint16_t configOpt = 0;
uint16_t configLen = (Settings.IP_Mode == IP_MODE_IPV4) ?
	sizeof(SlNetCfgIpV4Args_t) : sizeof(SlNetCfgIpV6Args_t);

newIPv4.Ip = Static_IPV4_Addr;
newIPv4.IpMask = Static_IPV4_Mask;
newIPv4.IpGateway = Static_IPV4_GW;
theSLStatus = sl_NetCfgSet(SL_NETCFG_IPV4_STA_ADDR_MODE, SL_NETCFG_ADDR_STATIC, sizeof(SlNetCfgIpV4Args_t), (uint8_t *) &newIPv4);

// hibernate
// ...
// wake from hibernation

sl_NetCfgGet(SL_NETCFG_IPV4_STA_ADDR_MODE, &configOpt, &configLen, (uint8_t *) &newIPv4);

// send packet

  • I don't think that there is an API to disable DAD (i will need to double check).

    Going to low power should be ok (maybe you won't be able to go to LSI during this time so you won't miss broadcasts).

    If you are ok with disabling DAD, you can just ignore the DAD validation.

    Br,

    Kobi 

  • As far as I can tell, ignoring the DAD validation doesn't seem to be an option. If I remove the wait for SL_IS_IPV6_ADDR_VALID to complete, a packet is not sent to the correct destination IP. In Wireshark I'm not seeing any IPV6 UDP packets being sent if I don't perform the wait. (It doesn't seem like a packet is being sent at all, not even to a different address.)

    However, I am getting a positive (>=0) response from the sl_SendTo function. See code below:

    int16_t socketID;
    int16_t         sendStatus;
    SlSockAddrIn6_t destAddrV6;
    
    socketID = sl_Socket(SL_AF_INET6, SL_SOCK_DGRAM, 0);
    
    destAddrV6.sin6_family = SL_AF_INET6;
    destAddrV6.sin6_port = sl_Htons(Settings.Destination_Port);
    destAddrV6.sin6_addr._S6_un._S6_u32[0] = sl_Htonl(Settings.Destination_IPV6[0]);
    destAddrV6.sin6_addr._S6_un._S6_u32[1] = sl_Htonl(Settings.Destination_IPV6[1]);
    destAddrV6.sin6_addr._S6_un._S6_u32[2] = sl_Htonl(Settings.Destination_IPV6[2]);
    destAddrV6.sin6_addr._S6_un._S6_u32[3] = sl_Htonl(Settings.Destination_IPV6[3]);
    
    /* Send UDP Packet */
    SlSockAddr_t * pSockAddr = NULL;
    pSockAddr = (SlSockAddr_t *) &destAddrV6;
    sendStatus = sl_SendTo(socketID, &UDP_Struct, sizeof(UDP_Struct), 0, pSockAddr, sizeof(SlSockAddr_t));
    
    if (sendStatus < 0)
    {
      LED_SetRGB(PWM_LED_RED, 0, 0);
    }
    else
    {
      LED_SetRGB(0, PWM_LED_GREEN, 0);
    }
    sl_Close(socketID);

    Is it possible that I would be able to send a packet faster if I used DHCP instead of a static address?

    Thanks much,
    Brian

  • DAD is needed for DHCP also.

    There is no option to expedite the IPv6 setup time.

    Br,

    Kobi