Message ID | 20201102193409.70901-11-kgraul@linux.ibm.com |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | net/smc: extend diagnostic netlink interface | expand |
Context | Check | Description |
---|---|---|
jkicinski/patch_count | success | Link |
jkicinski/cover_letter | success | Link |
jkicinski/fixes_present | success | Link |
jkicinski/tree_selection | success | Clearly marked for net-next |
jkicinski/subject_prefix | success | Link |
jkicinski/source_inline | success | Was 0 now: 0 |
jkicinski/verify_signedoff | success | Link |
jkicinski/module_param | success | Was 0 now: 0 |
jkicinski/build_32bit | fail | Errors and warnings before: 3 this patch: 5 |
jkicinski/kdoc | success | Errors and warnings before: 0 this patch: 0 |
jkicinski/verify_fixes | success | Link |
jkicinski/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 105 lines checked |
jkicinski/build_allmodconfig_warn | fail | Errors and warnings before: 0 this patch: 5 |
jkicinski/header_inline | success | Link |
jkicinski/stable | success | Stable not CCed |
On Mon, 2 Nov 2020 20:34:04 +0100 Karsten Graul wrote:
> + __u8 netdev[IFNAMSIZ]; /* ethernet device name */
In file included from <command-line>:32:
./usr/include/linux/smc_diag.h:135:14: error: ‘IFNAMSIZ’ undeclared here (not in a function)
135 | __u8 netdev[IFNAMSIZ]; /* ethernet device name */
| ^~~~~~~~
make[3]: *** [usr/include/linux/smc_diag.hdrtest] Error 1
make[2]: *** [usr/include] Error 2
make[1]: *** [usr] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: *** wait: No child processes. Stop.
make: *** [__sub-make] Error 2
In file included from <command-line>:32:
./usr/include/linux/smc_diag.h:135:14: error: ‘IFNAMSIZ’ undeclared here (not in a function)
135 | __u8 netdev[IFNAMSIZ]; /* ethernet device name */
| ^~~~~~~~
Hi Karsten,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Karsten-Graul/net-smc-extend-diagnostic-netlink-interface/20201103-034113
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git c43fd36f7fec6c227c5e8a8ddd7d3fe97472182f
config: x86_64-randconfig-a012-20201102 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/e4b66f234e85d211cd81aa99c901035874ebc469
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Karsten-Graul/net-smc-extend-diagnostic-netlink-interface/20201103-034113
git checkout e4b66f234e85d211cd81aa99c901035874ebc469
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from <command-line>:32:
>> ./usr/include/linux/smc_diag.h:135:14: error: 'IFNAMSIZ' undeclared here (not in a function)
135 | __u8 netdev[IFNAMSIZ]; /* ethernet device name */
| ^~~~~~~~
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/include/uapi/linux/smc_diag.h b/include/uapi/linux/smc_diag.h index 6ae028344b6d..16b8ea9da3d5 100644 --- a/include/uapi/linux/smc_diag.h +++ b/include/uapi/linux/smc_diag.h @@ -79,6 +79,7 @@ enum { /* SMC_DIAG_GET_LGR_INFO command extensions */ enum { SMC_DIAG_LGR_INFO_SMCR = 1, + SMC_DIAG_LGR_INFO_SMCR_LINK, }; #define SMC_DIAG_MAX (__SMC_DIAG_MAX - 1) @@ -129,6 +130,12 @@ struct smc_diag_linkinfo { __u8 ibport; /* RDMA device port number */ __u8 gid[40]; /* local GID */ __u8 peer_gid[40]; /* peer GID */ + /* Fields above used by legacy v1 code */ + __u32 conn_cnt; + __u8 netdev[IFNAMSIZ]; /* ethernet device name */ + __u8 link_uid[4]; /* unique link id */ + __u8 peer_link_uid[4]; /* unique peer link id */ + __u32 link_state; /* link state */ }; struct smc_diag_lgrinfo { diff --git a/net/smc/smc_diag.c b/net/smc/smc_diag.c index c53904b3f350..6885814b6e4f 100644 --- a/net/smc/smc_diag.c +++ b/net/smc/smc_diag.c @@ -20,6 +20,7 @@ #include <net/smc.h> #include "smc.h" +#include "smc_ib.h" #include "smc_core.h" struct smc_diag_dump_ctx { @@ -203,6 +204,54 @@ static bool smc_diag_fill_dmbinfo(struct sock *sk, struct sk_buff *skb) return true; } +static int smc_diag_fill_lgr_link(struct smc_link_group *lgr, + struct smc_link *link, + struct sk_buff *skb, + struct netlink_callback *cb, + struct smc_diag_req_v2 *req) +{ + struct smc_diag_linkinfo link_info; + int dummy = 0, rc = 0; + struct nlmsghdr *nlh; + + nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, MAGIC_SEQ_V2_ACK, + cb->nlh->nlmsg_type, 0, NLM_F_MULTI); + + memset(&link_info, 0, sizeof(link_info)); + link_info.link_state = link->state; + link_info.link_id = link->link_id; + link_info.conn_cnt = atomic_read(&link->conn_cnt); + link_info.ibport = link->ibport; + + memcpy(link_info.link_uid, link->link_uid, + sizeof(link_info.link_uid)); + snprintf(link_info.ibname, sizeof(link_info.ibname), "%s", + link->ibname); + snprintf(link_info.netdev, sizeof(link_info.netdev), "%s", + link->ndevname); + memcpy(link_info.peer_link_uid, link->peer_link_uid, + sizeof(link_info.peer_link_uid)); + + smc_gid_be16_convert(link_info.gid, + link->gid); + smc_gid_be16_convert(link_info.peer_gid, + link->peer_gid); + + /* Just a command place holder to signal back the command reply type */ + if (nla_put(skb, SMC_DIAG_GET_LGR_INFO, sizeof(dummy), &dummy) < 0) + goto errout; + if (nla_put(skb, SMC_DIAG_LGR_INFO_SMCR_LINK, + sizeof(link_info), &link_info) < 0) + goto errout; + + nlmsg_end(skb, nlh); + return rc; + +errout: + nlmsg_cancel(skb, nlh); + return -EMSGSIZE; +} + static int smc_diag_fill_lgr(struct smc_link_group *lgr, struct sk_buff *skb, struct netlink_callback *cb, @@ -238,7 +287,7 @@ static int smc_diag_handle_lgr(struct smc_link_group *lgr, struct smc_diag_req_v2 *req) { struct nlmsghdr *nlh; - int rc = 0; + int i, rc = 0; nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, MAGIC_SEQ_V2_ACK, cb->nlh->nlmsg_type, 0, NLM_F_MULTI); @@ -250,6 +299,17 @@ static int smc_diag_handle_lgr(struct smc_link_group *lgr, goto errout; nlmsg_end(skb, nlh); + + if ((req->cmd_ext & (1 << (SMC_DIAG_LGR_INFO_SMCR_LINK - 1)))) { + for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) { + if (!smc_link_usable(&lgr->lnk[i])) + continue; + rc = smc_diag_fill_lgr_link(lgr, &lgr->lnk[i], skb, + cb, req); + if (rc < 0) + goto errout; + } + } return rc; errout: