Parse timer period */
| 1443 | |
| 1444 | /** Parse timer period */ |
| 1445 | static int |
| 1446 | l2fwd_crypto_parse_timer_period(struct l2fwd_crypto_options *options, |
| 1447 | const char *q_arg) |
| 1448 | { |
| 1449 | char *end = NULL; |
| 1450 | unsigned long n; |
| 1451 | |
| 1452 | /* parse number string */ |
| 1453 | n = (unsigned)strtol(q_arg, &end, 10); |
| 1454 | if ((q_arg[0] == '\0') || (end == NULL) || (*end != '\0')) |
| 1455 | n = 0; |
| 1456 | |
| 1457 | if (n >= MAX_TIMER_PERIOD) { |
| 1458 | printf("Warning refresh period specified %lu is greater than " |
| 1459 | "max value %lu! using max value", |
| 1460 | n, MAX_TIMER_PERIOD); |
| 1461 | n = MAX_TIMER_PERIOD; |
| 1462 | } |
| 1463 | |
| 1464 | options->refresh_period = n * 1000 * TIMER_MILLISECOND; |
| 1465 | |
| 1466 | return 0; |
| 1467 | } |
| 1468 | |
| 1469 | /** Generate default options for application */ |
| 1470 | static void |
no test coverage detected