]>
git.proxmox.com Git - mirror_iproute2.git/blob - rdma/rdma.h
5809f7068ad293980bdc53a62eac0ded9376be29
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Authors: Leon Romanovsky <leonro@mellanox.com>
18 #include <libmnl/libmnl.h>
19 #include <rdma/rdma_netlink.h>
24 #include "json_writer.h"
26 #define pr_err(args...) fprintf(stderr, ##args)
27 #define pr_out(args...) fprintf(stdout, ##args)
29 #define RDMA_BITMAP_ENUM(name, bit_no) RDMA_BITMAP_##name = BIT(bit_no),
30 #define RDMA_BITMAP_NAMES(name, bit_no) [bit_no] = #name,
32 #define MAX_NUMBER_OF_FILTERS 64
39 struct list_head list
;
45 struct list_head list
;
56 struct list_head dev_map_list
;
59 struct mnl_socket
*nl
;
65 struct list_head filter_list
;
70 int (*func
)(struct rd
*rd
);
76 bool rd_no_arg(struct rd
*rd
);
77 void rd_arg_inc(struct rd
*rd
);
79 char *rd_argv(struct rd
*rd
);
84 int cmd_dev(struct rd
*rd
);
85 int cmd_link(struct rd
*rd
);
86 int cmd_res(struct rd
*rd
);
87 int rd_exec_cmd(struct rd
*rd
, const struct rd_cmd
*c
, const char *str
);
88 int rd_exec_dev(struct rd
*rd
, int (*cb
)(struct rd
*rd
));
89 int rd_exec_link(struct rd
*rd
, int (*cb
)(struct rd
*rd
), bool strict_port
);
90 void rd_free(struct rd
*rd
);
91 int rd_set_arg_to_devname(struct rd
*rd
);
92 int rd_argc(struct rd
*rd
);
94 int strcmpx(const char *str1
, const char *str2
);
99 struct dev_map
*dev_map_lookup(struct rd
*rd
, bool allow_port_index
);
102 * Filter manipulation
104 int rd_build_filter(struct rd
*rd
, const struct filters valid_filters
[]);
105 bool rd_check_is_filtered(struct rd
*rd
, const char *key
, uint32_t val
);
106 bool rd_check_is_string_filtered(struct rd
*rd
, const char *key
, const char *val
);
107 bool rd_check_is_key_exist(struct rd
*rd
, const char *key
);
111 int rd_send_msg(struct rd
*rd
);
112 int rd_recv_msg(struct rd
*rd
, mnl_cb_t callback
, void *data
, uint32_t seq
);
113 void rd_prepare_msg(struct rd
*rd
, uint32_t cmd
, uint32_t *seq
, uint16_t flags
);
114 int rd_dev_init_cb(const struct nlmsghdr
*nlh
, void *data
);
115 int rd_attr_cb(const struct nlattr
*attr
, void *data
);
116 #endif /* _RDMA_TOOL_H_ */