mbox series

[RFC,iproute2,0/8] rdma: print related patches

Message ID 20240103003558.20615-1-stephen@networkplumber.org (mailing list archive)
Headers show
Series rdma: print related patches | expand

Message

Stephen Hemminger Jan. 3, 2024, 12:34 a.m. UTC
This set of patches makes rdma comman behave more like the
other commands in iproute2 around printing flags.
There are some other things found while looking at that code.

Stephen Hemminger (8):
  rdma: shorten print_ lines
  rdma: use standard flag for json
  rdma: make pretty behave like other commands
  rdma: make supress_errors a bit
  rdma: add oneline flag
  rdma: do not mix newline and json object
  rdma: remove duplicate forward declaration
  rdma: remove unused rd argument

 man/man8/rdma.8 | 12 +++++++--
 rdma/dev.c      | 40 ++++++++++++++--------------
 rdma/link.c     | 52 +++++++++++++++++-------------------
 rdma/rdma.c     | 21 ++++++++++-----
 rdma/rdma.h     | 10 +++----
 rdma/res-cmid.c | 37 ++++++++++++--------------
 rdma/res-cq.c   | 35 ++++++++++++------------
 rdma/res-ctx.c  | 11 ++++----
 rdma/res-mr.c   | 26 +++++++++---------
 rdma/res-pd.c   | 21 +++++++--------
 rdma/res-qp.c   | 50 +++++++++++++++++-----------------
 rdma/res-srq.c  | 27 ++++++++++---------
 rdma/res.c      | 39 +++++++++++----------------
 rdma/res.h      | 18 +++++--------
 rdma/stat-mr.c  | 10 +++----
 rdma/stat.c     | 68 +++++++++++++++++++++-------------------------
 rdma/stat.h     |  4 +--
 rdma/sys.c      | 11 +++-----
 rdma/utils.c    | 71 +++++++++++++++++++------------------------------
 19 files changed, 267 insertions(+), 296 deletions(-)

Comments

Chengchang Tang Jan. 3, 2024, 4:02 a.m. UTC | #1
On 2024/1/3 8:34, Stephen Hemminger wrote:
> This set of patches makes rdma comman behave more like the
> other commands in iproute2 around printing flags.
> There are some other things found while looking at that code.
>
> Stephen Hemminger (8):
>    rdma: shorten print_ lines
>    rdma: use standard flag for json
>    rdma: make pretty behave like other commands
>    rdma: make supress_errors a bit
>    rdma: add oneline flag
>    rdma: do not mix newline and json object
>    rdma: remove duplicate forward declaration
>    rdma: remove unused rd argument
>
>   man/man8/rdma.8 | 12 +++++++--
>   rdma/dev.c      | 40 ++++++++++++++--------------
>   rdma/link.c     | 52 +++++++++++++++++-------------------
>   rdma/rdma.c     | 21 ++++++++++-----
>   rdma/rdma.h     | 10 +++----
>   rdma/res-cmid.c | 37 ++++++++++++--------------
>   rdma/res-cq.c   | 35 ++++++++++++------------
>   rdma/res-ctx.c  | 11 ++++----
>   rdma/res-mr.c   | 26 +++++++++---------
>   rdma/res-pd.c   | 21 +++++++--------
>   rdma/res-qp.c   | 50 +++++++++++++++++-----------------
>   rdma/res-srq.c  | 27 ++++++++++---------
>   rdma/res.c      | 39 +++++++++++----------------
>   rdma/res.h      | 18 +++++--------
>   rdma/stat-mr.c  | 10 +++----
>   rdma/stat.c     | 68 +++++++++++++++++++++-------------------------
>   rdma/stat.h     |  4 +--
>   rdma/sys.c      | 11 +++-----
>   rdma/utils.c    | 71 +++++++++++++++++++------------------------------
>   19 files changed, 267 insertions(+), 296 deletions(-)
>
Pretty mode works well. But there seems to be something wrong with 
oneline, which
puts all information on the same line. This behavior is different with ip.

```bash
[root@localhost iproute2]# ./rdma/rdma res show qp
link mlx5_0/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]
link mlx5_1/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]
link mlx5_2/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]
link hns_0/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]
link hns_1/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]
link hns_2/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]
link hns_3/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core]

[root@localhost iproute2]# ./rdma/rdma res show qp -o
link mlx5_0/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core] \link 
mlx5_1/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core] \link 
mlx5_2/1 lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core] \link hns_0/1 
lqpn 1 type GSI state RTS sq-psn 0 comm [ib_core] \link hns_1/1 lqpn 1 
type GSI state RTS sq-psn 0 comm [ib_core] \link hns_2/1 lqpn 1 type GSI 
state RTS sq-psn 0 comm [ib_core] \link hns_3/1 lqpn 1 type GSI state 
RTS sq-psn 0 comm [ib_core] \[root@localhost iproute2]#

[root@localhost iproute2]# ./ip/ip -o a
1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever 
preferred_lft forever
1: lo    inet6 ::1/128 scope host \       valid_lft forever 
preferred_lft forever
10: eth8    inet6 fe80::9e52:f8ff:fe8e:f307/64 scope link \ valid_lft 
forever preferred_lft forever
11: eth9    inet6 fe80::268a:7ff:fe55:41d0/64 scope link \ valid_lft 
forever preferred_lft forever
```

Tested-by: Chengchang Tang <tangchengchang@huawei.com>
Leon Romanovsky Jan. 3, 2024, 12:19 p.m. UTC | #2
On Tue, Jan 02, 2024 at 04:34:25PM -0800, Stephen Hemminger wrote:
> This set of patches makes rdma comman behave more like the
> other commands in iproute2 around printing flags.
> There are some other things found while looking at that code.
> 
> Stephen Hemminger (8):
>   rdma: shorten print_ lines
>   rdma: use standard flag for json
>   rdma: make pretty behave like other commands
>   rdma: make supress_errors a bit
>   rdma: add oneline flag
>   rdma: do not mix newline and json object
>   rdma: remove duplicate forward declaration
>   rdma: remove unused rd argument
> 

In addition to Chengchang comments.

LGTM,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>