You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ibmgmt_cmd.c 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (C) 2016 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. *
  19. * You can also choose to distribute this program under the terms of
  20. * the Unmodified Binary Distribution Licence (as given in the file
  21. * COPYING.UBDL), provided that you have satisfied its requirements.
  22. */
  23. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  24. #include <stdio.h>
  25. #include <errno.h>
  26. #include <getopt.h>
  27. #include <ipxe/command.h>
  28. #include <ipxe/parseopt.h>
  29. #include <ipxe/infiniband.h>
  30. #include <usr/ibmgmt.h>
  31. /** @file
  32. *
  33. * Infiniband device management commands
  34. *
  35. */
  36. /** "ibstat" options */
  37. struct ibstat_options {};
  38. /** "ibstat" option list */
  39. static struct option_descriptor ibstat_opts[] = {};
  40. /** "ibstat" command descriptor */
  41. static struct command_descriptor ibstat_cmd =
  42. COMMAND_DESC ( struct ibstat_options, ibstat_opts, 0, 0, "" );
  43. /**
  44. * The "ibstat" command
  45. *
  46. * @v argc Argument count
  47. * @v argv Argument list
  48. * @ret rc Return status code
  49. */
  50. static int ibstat_exec ( int argc, char **argv ) {
  51. struct ibstat_options opts;
  52. struct ib_device *ibdev;
  53. int rc;
  54. /* Parse options */
  55. if ( ( rc = parse_options ( argc, argv, &ibstat_cmd, &opts ) ) != 0 )
  56. return rc;
  57. /* Show all Infiniband devices */
  58. for_each_ibdev ( ibdev )
  59. ibstat ( ibdev );
  60. return 0;
  61. }
  62. /** Infiniband commands */
  63. struct command ibmgmt_commands[] __command = {
  64. {
  65. .name = "ibstat",
  66. .exec = ibstat_exec,
  67. },
  68. };