MCPcopy Create free account
hub / github.com/apache/nuttx / netdev_upper_ifup

Function netdev_upper_ifup

drivers/net/netdev_upperhalf.c:1208–1257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1206 ****************************************************************************/
1207
1208static int netdev_upper_ifup(FAR struct net_driver_s *dev)
1209{
1210 FAR struct netdev_upperhalf_s *upper = dev->d_private;
1211 int cpu = 1;
1212
1213 switch (upper->lower->rxtype)
1214 {
1215 case NETDEV_RX_THREAD_RSS:
1216 cpu = CONFIG_SMP_NCPUS;
1217 case NETDEV_RX_THREAD:
1218
1219 /* Try to bring up a dedicated thread for work. */
1220
1221 while (--cpu >= 0)
1222 {
1223 FAR struct netdev_thread_s *t = &upper->thread[cpu];
1224 FAR char *argv[3];
1225 char arg1[32];
1226 char arg2[32];
1227 char name[32];
1228
1229 snprintf(arg1, sizeof(arg1), "%p", upper);
1230 argv[0] = arg1;
1231
1232 snprintf(arg2, sizeof(arg2), "%d", cpu);
1233 argv[1] = arg2;
1234 argv[2] = NULL;
1235
1236 snprintf(name, sizeof(name), NETDEV_THREAD_NAME_FMT,
1237 dev->d_ifname);
1238
1239 t->tid = kthread_create(name, upper->lower->priority,
1240 CONFIG_DEFAULT_TASK_STACKSIZE,
1241 netdev_upper_loop, argv);
1242 if (t->tid < 0)
1243 {
1244 netdev_upper_exit_thread(upper);
1245 return t->tid;
1246 }
1247 }
1248 break;
1249 }
1250
1251 if (upper->lower->ops->ifup)
1252 {
1253 return upper->lower->ops->ifup(upper->lower);
1254 }
1255
1256 return -ENOSYS;
1257}
1258
1259static int netdev_upper_ifdown(FAR struct net_driver_s *dev)
1260{

Callers

nothing calls this directly

Calls 3

kthread_createFunction · 0.85
netdev_upper_exit_threadFunction · 0.85
snprintfFunction · 0.50

Tested by

no test coverage detected