Lines Matching +full:led +full:- +full:order

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2011-2012 Stefan Bethke.
85 /* Must match the ETHERSWITCH_PORT_LED_* enum order */
106 if (v & (1 << (i-1))) { in printb()
126 if (ioctl(cfg->fd, IOETHERSWITCHGETREG, &er) != 0) in read_register()
138 if (ioctl(cfg->fd, IOETHERSWITCHSETREG, &er) != 0) in write_register()
149 if (ioctl(cfg->fd, IOETHERSWITCHGETPHYREG, &er) != 0) in read_phyregister()
162 if (ioctl(cfg->fd, IOETHERSWITCHSETPHYREG, &er) != 0) in write_phyregister()
173 return (-1); in set_port_vid()
180 p.es_port = cfg->unit; in set_port_vid()
181 if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) in set_port_vid()
184 if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) in set_port_vid()
198 return (-1); in set_port_flag()
204 if (*flag == '-') { in set_port_flag()
226 p.es_port = cfg->unit; in set_port_flag()
227 if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) in set_port_flag()
233 if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) in set_port_flag()
246 return (-1); in set_port_media()
249 p.es_port = cfg->unit; in set_port_media()
252 if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) in set_port_media()
259 if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) in set_port_media()
272 return (-1); in set_port_mediaopt()
275 p.es_port = cfg->unit; in set_port_mediaopt()
278 if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) in set_port_mediaopt()
281 if (options == -1) in set_port_mediaopt()
288 if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) in set_port_mediaopt()
297 int led; in set_port_led() local
301 return (-1); in set_port_led()
304 p.es_port = cfg->unit; in set_port_led()
305 if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) in set_port_led()
308 led = strtol(argv[1], NULL, 0); in set_port_led()
309 if (led < 1 || led > p.es_nleds) in set_port_led()
310 errx(EX_USAGE, "invalid led number %s; must be between 1 and %d", in set_port_led()
313 led--; in set_port_led()
317 p.es_led[led] = i; in set_port_led()
322 errx(EX_USAGE, "invalid led style \"%s\"", argv[2]); in set_port_led()
324 if (ioctl(cfg->fd, IOETHERSWITCHSETPORT, &p) != 0) in set_port_led()
337 return (-1); in set_vlangroup_vid()
343 vg.es_vlangroup = cfg->unit; in set_vlangroup_vid()
344 if (ioctl(cfg->fd, IOETHERSWITCHGETVLANGROUP, &vg) != 0) in set_vlangroup_vid()
347 if (ioctl(cfg->fd, IOETHERSWITCHSETVLANGROUP, &vg) != 0) in set_vlangroup_vid()
361 return (-1); in set_vlangroup_members()
370 if (v < 0 || v >= cfg->info.es_nports) in set_vlangroup_members()
371 errx(EX_USAGE, "Member port must be between 0 and %d", cfg->info.es_nports-1); in set_vlangroup_members()
385 vg.es_vlangroup = cfg->unit; in set_vlangroup_members()
386 if (ioctl(cfg->fd, IOETHERSWITCHGETVLANGROUP, &vg) != 0) in set_vlangroup_members()
390 if (ioctl(cfg->fd, IOETHERSWITCHSETVLANGROUP, &vg) != 0) in set_vlangroup_members()
441 return (-1); in set_vlan_mode()
457 if (ioctl(cfg->fd, IOETHERSWITCHSETCONF, &conf) != 0) in set_vlan_mode()
484 return (-1); in atu_flush()
487 if (ioctl(cfg->fd, i, &p) != 0) in atu_flush()
506 if (ioctl(cfg->fd, IOETHERSWITCHGETTABLE, &p) != 0) in atu_dump()
513 if (ioctl(cfg->fd, IOETHERSWITCHGETTABLEENTRY, &e) != 0) in atu_dump()
530 c = strrchr(cfg->controlfile, '/'); in print_config()
534 c = cfg->controlfile; in print_config()
537 if (cfg->conf.cmd & ETHERSWITCH_CONF_VLAN_MODE) { in print_config()
539 switch (cfg->conf.vlan_mode) { in print_config()
561 if (cfg->conf.cmd & ETHERSWITCH_CONF_SWITCH_MACADDR) { in print_config()
564 ether_ntoa(&cfg->conf.switch_macaddr)); in print_config()
579 if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0) in print_port()
582 if (cfg->conf.vlan_mode == ETHERSWITCH_VLAN_DOT1Q) in print_port()
589 printf("%d:%s%s", i+1, ledstyles[p.es_led[i]], (i==p.es_nleds-1)?"":" "); in print_port()
603 if (cfg->mediatypes) { in print_port()
622 if (ioctl(cfg->fd, IOETHERSWITCHGETVLANGROUP, &vg) != 0) in print_vlangroup()
628 if (cfg->conf.vlan_mode == ETHERSWITCH_VLAN_PORT) in print_vlangroup()
635 for (i=0; i<cfg->info.es_nports; i++) { in print_vlangroup()
656 c = strrchr(cfg->controlfile, '/'); in print_info()
660 c = cfg->controlfile; in print_info()
661 if (cfg->verbose) { in print_info()
663 cfg->info.es_name, cfg->info.es_nports, in print_info()
664 cfg->info.es_nvlangroups); in print_info()
666 printb("VLAN capabilities", cfg->info.es_vlan_caps, in print_info()
671 for (i=0; i<cfg->info.es_nports; i++) { in print_info()
674 for (i=0; i<cfg->info.es_nvlangroups; i++) { in print_info()
683 fprintf(stderr, "\tetherswitchcfg [-f control file] info\n"); in usage()
684 fprintf(stderr, "\tetherswitchcfg [-f control file] config " in usage()
687 fprintf(stderr, "\tetherswitchcfg [-f control file] phy " in usage()
689 fprintf(stderr, "\tetherswitchcfg [-f control file] portX " in usage()
691 fprintf(stderr, "\t\tport commands: pvid, media, mediaopt, led\n"); in usage()
692 fprintf(stderr, "\tetherswitchcfg [-f control file] reg " in usage()
694 fprintf(stderr, "\tetherswitchcfg [-f control file] vlangroupX " in usage()
703 if (mode == cfg->mode) in newmode()
705 switch (cfg->mode) { in newmode()
713 if (ioctl(cfg->fd, IOETHERSWITCHGETCONF, &cfg->conf) != 0) in newmode()
718 print_port(cfg, cfg->unit); in newmode()
721 print_vlangroup(cfg, cfg->unit); in newmode()
728 cfg->mode = mode; in newmode()
740 while ((ch = getopt(argc, argv, "f:mv?")) != -1) in main()
756 argc -= optind; in main()
777 errx(EX_USAGE, "port unit must be between 0 and %d", cfg.info.es_nports - 1); in main()
783 cfg.info.es_nvlangroups - 1); in main()
807 if ((cmds[i].args != -1) && in main()
817 /* -1 here means "error" */ in main()
818 if (r == -1) { in main()
827 argc -= r; in main()
850 argc--; in main()
863 { MODE_PORT, "led", 2, set_port_led },
865 { MODE_PORT, "-addtag", 0, set_port_flag },
867 { MODE_PORT, "-ingress", 0, set_port_flag },
869 { MODE_PORT, "-striptag", 0, set_port_flag },
871 { MODE_PORT, "-striptagingress", 0, set_port_flag },
873 { MODE_PORT, "-doubletag", 0, set_port_flag },
875 { MODE_PORT, "-firstlock", 0, set_port_flag },
877 { MODE_PORT, "-droptagged", 0, set_port_flag },
879 { MODE_PORT, "-dropuntagged", 0, set_port_flag },
883 { MODE_ATU, "flush", -1, atu_flush },
884 { MODE_ATU, "dump", -1, atu_dump },