ucmd_netreset.c 494 B

12345678910111213141516171819202122232425
  1. /* netreset: ring-3 command. Full NIC re-init. */
  2. #include "ucmd_lib.h"
  3. void _start(const char *arg)
  4. {
  5. struct sys_netinfo n;
  6. (void)arg;
  7. if (u_syscall1(SYS_NET_INFO, (int)&n) != 1) {
  8. u_puts("netreset: no NIC found\n");
  9. u_exit(1);
  10. }
  11. if (u_syscall0(SYS_NET_RESET) != 0) {
  12. u_puts("netreset: not supported by ");
  13. u_puts(n.name);
  14. u_putc('\n');
  15. u_exit(1);
  16. }
  17. u_puts("netreset: re-initializing ");
  18. u_puts(n.name);
  19. u_puts("...\n");
  20. u_syscall0(SYS_NET_PRINT_INFO);
  21. u_exit(0);
  22. }