X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=rdma%2Frdma.h;h=dfd1b70b2e149dd8ea9af029836bddfa39c604b4;hb=f93134841ea8a75fde92615c0c223afc99396ff1;hp=35506a962fd9151434949321ae951a877569033e;hpb=6e0de6e886571cab7787f9b809b6db5e05b2444c;p=mirror_iproute2.git diff --git a/rdma/rdma.h b/rdma/rdma.h index 35506a96..dfd1b70b 100644 --- a/rdma/rdma.h +++ b/rdma/rdma.h @@ -1,11 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ /* * rdma.c RDMA tool - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * * Authors: Leon Romanovsky */ #ifndef _RDMA_TOOL_H_ @@ -15,9 +10,12 @@ #include #include #include +#include #include #include +#include #include +#include #include "list.h" #include "utils.h" @@ -31,14 +29,21 @@ #define MAX_NUMBER_OF_FILTERS 64 struct filters { - char name[32]; - bool is_number; + const char *name; + uint8_t is_number:1; + uint8_t is_doit:1; }; struct filter_entry { struct list_head list; char *key; char *value; + /* + * This field menas that we can try to issue .doit calback + * on value above. This value can be converted to integer + * with simple atoi(). Otherwise "is_doit" will be false. + */ + uint8_t is_doit:1; }; struct dev_map { @@ -53,6 +58,7 @@ struct rd { char **argv; char *filename; bool show_details; + bool show_driver_details; struct list_head dev_map_list; uint32_t dev_idx; uint32_t port_idx; @@ -62,7 +68,10 @@ struct rd { json_writer_t *jw; bool json_output; bool pretty_output; + bool suppress_errors; struct list_head filter_list; + char *link_name; + char *link_type; }; struct rd_cmd { @@ -83,13 +92,19 @@ char *rd_argv(struct rd *rd); */ int cmd_dev(struct rd *rd); int cmd_link(struct rd *rd); +int cmd_res(struct rd *rd); +int cmd_sys(struct rd *rd); +int cmd_stat(struct rd *rd); int rd_exec_cmd(struct rd *rd, const struct rd_cmd *c, const char *str); int rd_exec_dev(struct rd *rd, int (*cb)(struct rd *rd)); +int rd_exec_require_dev(struct rd *rd, int (*cb)(struct rd *rd)); int rd_exec_link(struct rd *rd, int (*cb)(struct rd *rd), bool strict_port); void rd_free(struct rd *rd); int rd_set_arg_to_devname(struct rd *rd); int rd_argc(struct rd *rd); +int strcmpx(const char *str1, const char *str2); + /* * Device manipulation */ @@ -98,16 +113,30 @@ struct dev_map *dev_map_lookup(struct rd *rd, bool allow_port_index); /* * Filter manipulation */ +bool rd_doit_index(struct rd *rd, uint32_t *idx); int rd_build_filter(struct rd *rd, const struct filters valid_filters[]); -bool rd_check_is_filtered(struct rd *rd, const char *key, uint32_t val); -bool rd_check_is_string_filtered(struct rd *rd, const char *key, const char *val); -bool rd_check_is_key_exist(struct rd *rd, const char *key); +bool rd_is_filtered_attr(struct rd *rd, const char *key, uint32_t val, + struct nlattr *attr); +bool rd_is_string_filtered_attr(struct rd *rd, const char *key, const char *val, + struct nlattr *attr); /* * Netlink */ int rd_send_msg(struct rd *rd); int rd_recv_msg(struct rd *rd, mnl_cb_t callback, void *data, uint32_t seq); +int rd_sendrecv_msg(struct rd *rd, unsigned int seq); void rd_prepare_msg(struct rd *rd, uint32_t cmd, uint32_t *seq, uint16_t flags); int rd_dev_init_cb(const struct nlmsghdr *nlh, void *data); int rd_attr_cb(const struct nlattr *attr, void *data); +int rd_attr_check(const struct nlattr *attr, int *typep); + +/* + * Print helpers + */ +void print_driver_table(struct rd *rd, struct nlattr *tb); +void newline(struct rd *rd); +void newline_indent(struct rd *rd); +void print_on_off(struct rd *rd, const char *key_str, bool on); +#define MAX_LINE_LENGTH 80 + #endif /* _RDMA_TOOL_H_ */