lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201902081826.0KmqBJJs%fengguang.wu@intel.com>
Date:   Fri, 8 Feb 2019 19:00:02 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Vasundhara Volam <vasundhara-v.volam@...adcom.com>
Cc:     kbuild-all@...org, davem@...emloft.net, michael.chan@...adcom.com,
        jiri@...lanox.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 1/2] Revert "devlink: Add a generic wake_on_lan
 port parameter"

Hi Vasundhara,

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/Vasundhara-Volam/Revert-wake_on_lan-devlink-parameter/20190208-181949
config: i386-randconfig-x000-201905 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-14) 8.2.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

Note: the linux-review/Vasundhara-Volam/Revert-wake_on_lan-devlink-parameter/20190208-181949 HEAD caa636fa491621c75cb625cb981adfe514368a45 builds fine.
      It only hurts bisectibility.

All error/warnings (new ones prefixed by >>):

>> drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:41:3: error: 'DEVLINK_PARAM_GENERIC_ID_WOL' undeclared here (not in a function); did you mean 'DEVLINK_PARAM_GENERIC_ID_MAX'?
     {DEVLINK_PARAM_GENERIC_ID_WOL, NVM_OFF_WOL, BNXT_NVM_PORT_CFG, 1},
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      DEVLINK_PARAM_GENERIC_ID_MAX
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c: In function 'bnxt_hwrm_nvm_req':
>> drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:76:20: warning: comparison between pointer and integer
          nvm_param.id != DEVLINK_PARAM_GENERIC_ID_WOL)
                       ^~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c: In function 'bnxt_dl_wol_validate':
>> drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:174:28: error: 'DEVLINK_PARAM_WAKE_MAGIC' undeclared (first use in this function); did you mean 'DEVLINK_PARAM_CMODE_MAX'?
     if (val.vu8 && val.vu8 != DEVLINK_PARAM_WAKE_MAGIC) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~
                               DEVLINK_PARAM_CMODE_MAX
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:174:28: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:174:25: warning: comparison between pointer and integer
     if (val.vu8 && val.vu8 != DEVLINK_PARAM_WAKE_MAGIC) {
                            ^~
   In file included from drivers/net//ethernet/broadcom/bnxt/bnxt.h:23,
                    from drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:13:
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c: At top level:
>> include/net/devlink.h:404:8: warning: initialization of 'unsigned int' from 'const struct bnxt_dl_nvm_param *' makes integer from pointer without a cast [-Wint-conversion]
     .id = DEVLINK_PARAM_GENERIC_ID_##_id,    \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:404:8: note: (near initialization for 'bnxt_dl_port_params[0].id')
     .id = DEVLINK_PARAM_GENERIC_ID_##_id,    \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:404:8: error: initializer element is not constant
     .id = DEVLINK_PARAM_GENERIC_ID_##_id,    \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:404:8: note: (near initialization for 'bnxt_dl_port_params[0].id')
     .id = DEVLINK_PARAM_GENERIC_ID_##_id,    \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:405:10: error: 'DEVLINK_PARAM_GENERIC_WOL_NAME' undeclared here (not in a function); did you mean 'DEVLINK_PARAM_GENERIC_ID_MAX'?
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:405:10: error: initialization of 'const char *' from incompatible pointer type 'const struct bnxt_dl_nvm_param *' [-Werror=incompatible-pointer-types]
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:405:10: note: (near initialization for 'bnxt_dl_port_params[0].name')
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:405:10: error: initializer element is not constant
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:405:10: note: (near initialization for 'bnxt_dl_port_params[0].name')
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:406:10: error: 'DEVLINK_PARAM_GENERIC_WOL_TYPE' undeclared here (not in a function); did you mean 'DEVLINK_PARAM_GENERIC_ID_MAX'?
     .type = DEVLINK_PARAM_GENERIC_##_id##_TYPE,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:406:10: error: incompatible types when initializing type 'enum devlink_param_type' using type 'const struct bnxt_dl_nvm_param *'
     .type = DEVLINK_PARAM_GENERIC_##_id##_TYPE,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:41:3: error: 'DEVLINK_PARAM_GENERIC_ID_WOL' undeclared here (not in a function); did you mean 'DEVLINK_PARAM_GENERIC_ID_MAX'?
     {DEVLINK_PARAM_GENERIC_ID_WOL, NVM_OFF_WOL, BNXT_NVM_PORT_CFG, 1},
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      DEVLINK_PARAM_GENERIC_ID_MAX
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c: In function 'bnxt_hwrm_nvm_req':
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:76:20: warning: comparison between pointer and integer
          nvm_param.id != DEVLINK_PARAM_GENERIC_ID_WOL)
                       ^~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c: In function 'bnxt_dl_wol_validate':
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:174:28: error: 'DEVLINK_PARAM_WAKE_MAGIC' undeclared (first use in this function); did you mean 'DEVLINK_PARAM_CMODE_MAX'?
     if (val.vu8 && val.vu8 != DEVLINK_PARAM_WAKE_MAGIC) {
                               ^~~~~~~~~~~~~~~~~~~~~~~~
                               DEVLINK_PARAM_CMODE_MAX
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:174:28: note: each undeclared identifier is reported only once for each function it appears in
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:174:25: warning: comparison between pointer and integer
     if (val.vu8 && val.vu8 != DEVLINK_PARAM_WAKE_MAGIC) {
                            ^~
   In file included from drivers/net/ethernet/broadcom/bnxt/bnxt.h:23,
                    from drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:13:
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c: At top level:
>> include/net/devlink.h:404:8: warning: initialization of 'unsigned int' from 'const struct bnxt_dl_nvm_param *' makes integer from pointer without a cast [-Wint-conversion]
     .id = DEVLINK_PARAM_GENERIC_ID_##_id,    \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:404:8: note: (near initialization for 'bnxt_dl_port_params[0].id')
     .id = DEVLINK_PARAM_GENERIC_ID_##_id,    \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:404:8: error: initializer element is not constant
     .id = DEVLINK_PARAM_GENERIC_ID_##_id,    \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:404:8: note: (near initialization for 'bnxt_dl_port_params[0].id')
     .id = DEVLINK_PARAM_GENERIC_ID_##_id,    \
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:405:10: error: 'DEVLINK_PARAM_GENERIC_WOL_NAME' undeclared here (not in a function); did you mean 'DEVLINK_PARAM_GENERIC_ID_MAX'?
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:405:10: error: initialization of 'const char *' from incompatible pointer type 'const struct bnxt_dl_nvm_param *' [-Werror=incompatible-pointer-types]
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:405:10: note: (near initialization for 'bnxt_dl_port_params[0].name')
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:405:10: error: initializer element is not constant
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   include/net/devlink.h:405:10: note: (near initialization for 'bnxt_dl_port_params[0].name')
     .name = DEVLINK_PARAM_GENERIC_##_id##_NAME,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:406:10: error: 'DEVLINK_PARAM_GENERIC_WOL_TYPE' undeclared here (not in a function); did you mean 'DEVLINK_PARAM_GENERIC_ID_MAX'?
     .type = DEVLINK_PARAM_GENERIC_##_id##_TYPE,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
>> include/net/devlink.h:406:10: error: incompatible types when initializing type 'enum devlink_param_type' using type 'const struct bnxt_dl_nvm_param *'
     .type = DEVLINK_PARAM_GENERIC_##_id##_TYPE,   \
             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:206:2: note: in expansion of macro 'DEVLINK_PARAM_GENERIC'
     DEVLINK_PARAM_GENERIC(WOL, BIT(DEVLINK_PARAM_CMODE_PERMANENT),
     ^~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +41 drivers/net//ethernet/broadcom/bnxt/bnxt_devlink.c

2dc0865e Vasundhara Volam    2018-10-04   28  
6354b95e Vasundhara Volam    2018-07-04   29  static const struct bnxt_dl_nvm_param nvm_params[] = {
6354b95e Vasundhara Volam    2018-07-04   30  	{DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV, NVM_OFF_ENABLE_SRIOV,
6354b95e Vasundhara Volam    2018-07-04   31  	 BNXT_NVM_SHARED_CFG, 1},
7d859234 Vasundhara Volam    2018-10-04   32  	{DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI, NVM_OFF_IGNORE_ARI,
7d859234 Vasundhara Volam    2018-10-04   33  	 BNXT_NVM_SHARED_CFG, 1},
f399e849 Vasundhara Volam    2018-10-04   34  	{DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
f399e849 Vasundhara Volam    2018-10-04   35  	 NVM_OFF_MSIX_VEC_PER_PF_MAX, BNXT_NVM_SHARED_CFG, 10},
f399e849 Vasundhara Volam    2018-10-04   36  	{DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
f399e849 Vasundhara Volam    2018-10-04   37  	 NVM_OFF_MSIX_VEC_PER_PF_MIN, BNXT_NVM_SHARED_CFG, 7},
2dc0865e Vasundhara Volam    2018-10-04   38  	{BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK, NVM_OFF_DIS_GRE_VER_CHECK,
2dc0865e Vasundhara Volam    2018-10-04   39  	 BNXT_NVM_SHARED_CFG, 1},
782a624d Vasundhara Volam    2019-01-28   40  
782a624d Vasundhara Volam    2019-01-28  @41  	{DEVLINK_PARAM_GENERIC_ID_WOL, NVM_OFF_WOL, BNXT_NVM_PORT_CFG, 1},
6354b95e Vasundhara Volam    2018-07-04   42  };
6354b95e Vasundhara Volam    2018-07-04   43  
6354b95e Vasundhara Volam    2018-07-04   44  static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
6354b95e Vasundhara Volam    2018-07-04   45  			     int msg_len, union devlink_param_value *val)
6354b95e Vasundhara Volam    2018-07-04   46  {
6fc92c33 Michael Chan        2018-08-05   47  	struct hwrm_nvm_get_variable_input *req = msg;
6354b95e Vasundhara Volam    2018-07-04   48  	void *data_addr = NULL, *buf = NULL;
6354b95e Vasundhara Volam    2018-07-04   49  	struct bnxt_dl_nvm_param nvm_param;
6354b95e Vasundhara Volam    2018-07-04   50  	int bytesize, idx = 0, rc, i;
6354b95e Vasundhara Volam    2018-07-04   51  	dma_addr_t data_dma_addr;
6354b95e Vasundhara Volam    2018-07-04   52  
6354b95e Vasundhara Volam    2018-07-04   53  	/* Get/Set NVM CFG parameter is supported only on PFs */
6354b95e Vasundhara Volam    2018-07-04   54  	if (BNXT_VF(bp))
6354b95e Vasundhara Volam    2018-07-04   55  		return -EPERM;
6354b95e Vasundhara Volam    2018-07-04   56  
6354b95e Vasundhara Volam    2018-07-04   57  	for (i = 0; i < ARRAY_SIZE(nvm_params); i++) {
6354b95e Vasundhara Volam    2018-07-04   58  		if (nvm_params[i].id == param_id) {
6354b95e Vasundhara Volam    2018-07-04   59  			nvm_param = nvm_params[i];
6354b95e Vasundhara Volam    2018-07-04   60  			break;
6354b95e Vasundhara Volam    2018-07-04   61  		}
6354b95e Vasundhara Volam    2018-07-04   62  	}
6354b95e Vasundhara Volam    2018-07-04   63  
65fac4fe zhong jiang         2018-09-18   64  	if (i == ARRAY_SIZE(nvm_params))
65fac4fe zhong jiang         2018-09-18   65  		return -EOPNOTSUPP;
65fac4fe zhong jiang         2018-09-18   66  
6354b95e Vasundhara Volam    2018-07-04   67  	if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
6354b95e Vasundhara Volam    2018-07-04   68  		idx = bp->pf.port_id;
6354b95e Vasundhara Volam    2018-07-04   69  	else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)
6354b95e Vasundhara Volam    2018-07-04   70  		idx = bp->pf.fw_fid - BNXT_FIRST_PF_FID;
6354b95e Vasundhara Volam    2018-07-04   71  
6354b95e Vasundhara Volam    2018-07-04   72  	bytesize = roundup(nvm_param.num_bits, BITS_PER_BYTE) / BITS_PER_BYTE;
f399e849 Vasundhara Volam    2018-10-04   73  	switch (bytesize) {
f399e849 Vasundhara Volam    2018-10-04   74  	case 1:
782a624d Vasundhara Volam    2019-01-28   75  		if (nvm_param.num_bits == 1 &&
782a624d Vasundhara Volam    2019-01-28  @76  		    nvm_param.id != DEVLINK_PARAM_GENERIC_ID_WOL)
6354b95e Vasundhara Volam    2018-07-04   77  			buf = &val->vbool;
f399e849 Vasundhara Volam    2018-10-04   78  		else
f399e849 Vasundhara Volam    2018-10-04   79  			buf = &val->vu8;
f399e849 Vasundhara Volam    2018-10-04   80  		break;
f399e849 Vasundhara Volam    2018-10-04   81  	case 2:
f399e849 Vasundhara Volam    2018-10-04   82  		buf = &val->vu16;
f399e849 Vasundhara Volam    2018-10-04   83  		break;
f399e849 Vasundhara Volam    2018-10-04   84  	case 4:
f399e849 Vasundhara Volam    2018-10-04   85  		buf = &val->vu32;
f399e849 Vasundhara Volam    2018-10-04   86  		break;
f399e849 Vasundhara Volam    2018-10-04   87  	default:
f399e849 Vasundhara Volam    2018-10-04   88  		return -EFAULT;
f399e849 Vasundhara Volam    2018-10-04   89  	}
6354b95e Vasundhara Volam    2018-07-04   90  
750afb08 Luis Chamberlain    2019-01-04   91  	data_addr = dma_alloc_coherent(&bp->pdev->dev, bytesize,
6354b95e Vasundhara Volam    2018-07-04   92  				       &data_dma_addr, GFP_KERNEL);
6354b95e Vasundhara Volam    2018-07-04   93  	if (!data_addr)
6354b95e Vasundhara Volam    2018-07-04   94  		return -ENOMEM;
6354b95e Vasundhara Volam    2018-07-04   95  
6fc92c33 Michael Chan        2018-08-05   96  	req->dest_data_addr = cpu_to_le64(data_dma_addr);
6354b95e Vasundhara Volam    2018-07-04   97  	req->data_len = cpu_to_le16(nvm_param.num_bits);
6354b95e Vasundhara Volam    2018-07-04   98  	req->option_num = cpu_to_le16(nvm_param.offset);
6354b95e Vasundhara Volam    2018-07-04   99  	req->index_0 = cpu_to_le16(idx);
6354b95e Vasundhara Volam    2018-07-04  100  	if (idx)
6354b95e Vasundhara Volam    2018-07-04  101  		req->dimensions = cpu_to_le16(1);
6354b95e Vasundhara Volam    2018-07-04  102  
6fc92c33 Michael Chan        2018-08-05  103  	if (req->req_type == cpu_to_le16(HWRM_NVM_SET_VARIABLE))
6354b95e Vasundhara Volam    2018-07-04  104  		memcpy(data_addr, buf, bytesize);
6354b95e Vasundhara Volam    2018-07-04  105  
6354b95e Vasundhara Volam    2018-07-04  106  	rc = hwrm_send_message(bp, msg, msg_len, HWRM_CMD_TIMEOUT);
6fc92c33 Michael Chan        2018-08-05  107  	if (!rc && req->req_type == cpu_to_le16(HWRM_NVM_GET_VARIABLE))
6354b95e Vasundhara Volam    2018-07-04  108  		memcpy(buf, data_addr, bytesize);
6354b95e Vasundhara Volam    2018-07-04  109  
6354b95e Vasundhara Volam    2018-07-04  110  	dma_free_coherent(&bp->pdev->dev, bytesize, data_addr, data_dma_addr);
3a1d52a5 Vasundhara Volam    2018-10-04  111  	if (rc == HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED) {
3a1d52a5 Vasundhara Volam    2018-10-04  112  		netdev_err(bp->dev, "PF does not have admin privileges to modify NVM config\n");
3a1d52a5 Vasundhara Volam    2018-10-04  113  		return -EACCES;
3a1d52a5 Vasundhara Volam    2018-10-04  114  	} else if (rc) {
6354b95e Vasundhara Volam    2018-07-04  115  		return -EIO;
3a1d52a5 Vasundhara Volam    2018-10-04  116  	}
6354b95e Vasundhara Volam    2018-07-04  117  	return 0;
6354b95e Vasundhara Volam    2018-07-04  118  }
6354b95e Vasundhara Volam    2018-07-04  119  
6354b95e Vasundhara Volam    2018-07-04  120  static int bnxt_dl_nvm_param_get(struct devlink *dl, u32 id,
6354b95e Vasundhara Volam    2018-07-04  121  				 struct devlink_param_gset_ctx *ctx)
6354b95e Vasundhara Volam    2018-07-04  122  {
6354b95e Vasundhara Volam    2018-07-04  123  	struct hwrm_nvm_get_variable_input req = {0};
6354b95e Vasundhara Volam    2018-07-04  124  	struct bnxt *bp = bnxt_get_bp_from_dl(dl);
2dc0865e Vasundhara Volam    2018-10-04  125  	int rc;
6354b95e Vasundhara Volam    2018-07-04  126  
6354b95e Vasundhara Volam    2018-07-04  127  	bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_GET_VARIABLE, -1, -1);
2dc0865e Vasundhara Volam    2018-10-04  128  	rc = bnxt_hwrm_nvm_req(bp, id, &req, sizeof(req), &ctx->val);
2dc0865e Vasundhara Volam    2018-10-04  129  	if (!rc)
2dc0865e Vasundhara Volam    2018-10-04  130  		if (id == BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK)
2dc0865e Vasundhara Volam    2018-10-04  131  			ctx->val.vbool = !ctx->val.vbool;
2dc0865e Vasundhara Volam    2018-10-04  132  
2dc0865e Vasundhara Volam    2018-10-04  133  	return rc;
6354b95e Vasundhara Volam    2018-07-04  134  }
6354b95e Vasundhara Volam    2018-07-04  135  
6354b95e Vasundhara Volam    2018-07-04  136  static int bnxt_dl_nvm_param_set(struct devlink *dl, u32 id,
6354b95e Vasundhara Volam    2018-07-04  137  				 struct devlink_param_gset_ctx *ctx)
6354b95e Vasundhara Volam    2018-07-04  138  {
6354b95e Vasundhara Volam    2018-07-04  139  	struct hwrm_nvm_set_variable_input req = {0};
6354b95e Vasundhara Volam    2018-07-04  140  	struct bnxt *bp = bnxt_get_bp_from_dl(dl);
6354b95e Vasundhara Volam    2018-07-04  141  
6354b95e Vasundhara Volam    2018-07-04  142  	bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_SET_VARIABLE, -1, -1);
2dc0865e Vasundhara Volam    2018-10-04  143  
2dc0865e Vasundhara Volam    2018-10-04  144  	if (id == BNXT_DEVLINK_PARAM_ID_GRE_VER_CHECK)
2dc0865e Vasundhara Volam    2018-10-04  145  		ctx->val.vbool = !ctx->val.vbool;
2dc0865e Vasundhara Volam    2018-10-04  146  
6354b95e Vasundhara Volam    2018-07-04  147  	return bnxt_hwrm_nvm_req(bp, id, &req, sizeof(req), &ctx->val);
6354b95e Vasundhara Volam    2018-07-04  148  }
6354b95e Vasundhara Volam    2018-07-04  149  
f399e849 Vasundhara Volam    2018-10-04  150  static int bnxt_dl_msix_validate(struct devlink *dl, u32 id,
f399e849 Vasundhara Volam    2018-10-04  151  				 union devlink_param_value val,
f399e849 Vasundhara Volam    2018-10-04  152  				 struct netlink_ext_ack *extack)
f399e849 Vasundhara Volam    2018-10-04  153  {
5fc7c12f Gustavo A. R. Silva 2018-10-05  154  	int max_val = -1;
f399e849 Vasundhara Volam    2018-10-04  155  
f399e849 Vasundhara Volam    2018-10-04  156  	if (id == DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX)
f399e849 Vasundhara Volam    2018-10-04  157  		max_val = BNXT_MSIX_VEC_MAX;
f399e849 Vasundhara Volam    2018-10-04  158  
f399e849 Vasundhara Volam    2018-10-04  159  	if (id == DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN)
f399e849 Vasundhara Volam    2018-10-04  160  		max_val = BNXT_MSIX_VEC_MIN_MAX;
f399e849 Vasundhara Volam    2018-10-04  161  
5fc7c12f Gustavo A. R. Silva 2018-10-05  162  	if (val.vu32 > max_val) {
f399e849 Vasundhara Volam    2018-10-04  163  		NL_SET_ERR_MSG_MOD(extack, "MSIX value is exceeding the range");
f399e849 Vasundhara Volam    2018-10-04  164  		return -EINVAL;
f399e849 Vasundhara Volam    2018-10-04  165  	}
f399e849 Vasundhara Volam    2018-10-04  166  
f399e849 Vasundhara Volam    2018-10-04  167  	return 0;
f399e849 Vasundhara Volam    2018-10-04  168  }
f399e849 Vasundhara Volam    2018-10-04  169  
782a624d Vasundhara Volam    2019-01-28  170  static int bnxt_dl_wol_validate(struct devlink *dl, u32 id,
782a624d Vasundhara Volam    2019-01-28  171  				union devlink_param_value val,
782a624d Vasundhara Volam    2019-01-28  172  				struct netlink_ext_ack *extack)
782a624d Vasundhara Volam    2019-01-28  173  {
782a624d Vasundhara Volam    2019-01-28 @174  	if (val.vu8 && val.vu8 != DEVLINK_PARAM_WAKE_MAGIC) {
782a624d Vasundhara Volam    2019-01-28  175  		NL_SET_ERR_MSG_MOD(extack, "WOL type is not supported");
782a624d Vasundhara Volam    2019-01-28  176  		return -EINVAL;
782a624d Vasundhara Volam    2019-01-28  177  	}
782a624d Vasundhara Volam    2019-01-28  178  	return 0;
782a624d Vasundhara Volam    2019-01-28  179  }
782a624d Vasundhara Volam    2019-01-28  180  

:::::: The code at line 41 was first introduced by commit
:::::: 782a624d00fa22e7499f5abc29747501ec671313 bnxt_en: Add bnxt_en initial port params table and register it

:::::: TO: Vasundhara Volam <vasundhara-v.volam@...adcom.com>
:::::: CC: David S. Miller <davem@...emloft.net>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Download attachment ".config.gz" of type "application/gzip" (34458 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ