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>] [day] [month] [year] [list]
Message-ID: <202007020212.eRt7lED2%lkp@intel.com>
Date:   Thu, 2 Jul 2020 02:33:15 +0800
From:   kernel test robot <lkp@...el.com>
To:     Po Liu <Po.Liu@....com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/net/ethernet/freescale/enetc/enetc_qos.c:491:30: sparse:
 sparse: incorrect type in assignment (different base types)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7c30b859a947535f2213277e827d7ac7dcff9c84
commit: 888ae5a3952badf11fdcd210f5da9994462ec2fc net: enetc: add tc flower psfp offload driver
date:   9 weeks ago
config: powerpc64-randconfig-s032-20200701 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-3-gfa153962-dirty
        git checkout 888ae5a3952badf11fdcd210f5da9994462ec2fc
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>


sparse warnings: (new ones prefixed by >>)

   drivers/net/ethernet/freescale/enetc/enetc_qos.c:134:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:134:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:134:21: sparse:     got unsigned int [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:135:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:135:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:135:21: sparse:     got unsigned int [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:427:20: sparse: sparse: symbol 'enetc_act_fwd' was not declared. Should it be static?
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:488:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:488:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:488:21: sparse:     got unsigned int [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:489:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:489:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:489:21: sparse:     got unsigned int [usertype]
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:491:30: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] vid_vidm_tg @@     got restricted __le16 [usertype] @@
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:491:30: sparse:     expected unsigned short [usertype] vid_vidm_tg
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:491:30: sparse:     got restricted __le16 [usertype]
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:497:25: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] iports @@     got int @@
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:497:25: sparse:     expected restricted __le32 [usertype] iports
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:497:25: sparse:     got int
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:522:25: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] iports @@     got int @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:522:25: sparse:     expected restricted __le32 [usertype] iports
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:522:25: sparse:     got int
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:532:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:532:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:532:21: sparse:     got unsigned int [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:533:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:533:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:533:21: sparse:     got unsigned int [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:542:38: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] vid_vidm_tg @@     got restricted __le16 [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:542:38: sparse:     expected unsigned short [usertype] vid_vidm_tg
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:542:38: sparse:     got restricted __le16 [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:548:38: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] vid_vidm_tg @@     got restricted __le16 [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:548:38: sparse:     expected unsigned short [usertype] vid_vidm_tg
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:548:38: sparse:     got restricted __le16 [usertype]
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:586:33: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] input_ports @@     got int @@
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:586:33: sparse:     expected restricted __le32 [usertype] input_ports
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:586:33: sparse:     got int
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:636:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:636:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:636:21: sparse:     got unsigned int [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:637:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:637:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:637:21: sparse:     got unsigned int [usertype]
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:646:31: sparse: sparse: cast to restricted __le32
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:646:31: sparse: sparse: cast to restricted __le32
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:646:31: sparse: sparse: cast to restricted __le32
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:646:31: sparse: sparse: cast to restricted __le32
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:646:31: sparse: sparse: cast to restricted __le32
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:646:31: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:650:31: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:650:31: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:650:31: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:650:31: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:650:31: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:650:31: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:657:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:657:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:657:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:657:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:657:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:657:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:658:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:658:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:658:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:658:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:658:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:658:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:665:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:665:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:665:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:665:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:665:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:665:23: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:666:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:666:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:666:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:666:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:666:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:666:19: sparse: sparse: cast to restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:773:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:773:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:773:21: sparse:     got unsigned int [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:774:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 @@     got unsigned int [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:774:21: sparse:     expected restricted __le32
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:774:21: sparse:     got unsigned int [usertype]
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:780:23: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] ct @@     got restricted __le32 [usertype] @@
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:780:23: sparse:     expected unsigned int [usertype] ct
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:780:23: sparse:     got restricted __le32 [usertype]
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:781:24: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] cte @@     got restricted __le32 [usertype] @@
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:781:24: sparse:     expected unsigned int [usertype] cte
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:781:24: sparse:     got restricted __le32 [usertype]
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:803:30: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] interval @@     got restricted __le32 [usertype] @@
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:803:30: sparse:     expected unsigned int [usertype] interval
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:803:30: sparse:     got restricted __le32 [usertype]
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:815:32: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] btl @@     got restricted __le32 [usertype] @@
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:815:32: sparse:     expected unsigned int [usertype] btl
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:815:32: sparse:     got restricted __le32 [usertype]
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:816:32: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] bth @@     got restricted __le32 [usertype] @@
>> drivers/net/ethernet/freescale/enetc/enetc_qos.c:816:32: sparse:     expected unsigned int [usertype] bth
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:816:32: sparse:     got restricted __le32 [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:822:32: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] bth @@     got restricted __le32 [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:822:32: sparse:     expected unsigned int [usertype] bth
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:822:32: sparse:     got restricted __le32 [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:823:32: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] btl @@     got restricted __le32 [usertype] @@
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:823:32: sparse:     expected unsigned int [usertype] btl
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:823:32: sparse:     got restricted __le32 [usertype]
   drivers/net/ethernet/freescale/enetc/enetc_qos.c:966:20: sparse: sparse: symbol 'enetc_check_flow_actions' was not declared. Should it be static?

vim +491 drivers/net/ethernet/freescale/enetc/enetc_qos.c

   426	
 > 427	struct actions_fwd enetc_act_fwd[] = {
   428		{
   429			BIT(FLOW_ACTION_GATE),
   430			BIT(FLOW_DISSECTOR_KEY_ETH_ADDRS),
   431			FILTER_ACTION_TYPE_PSFP
   432		},
   433		/* example for ACL actions */
   434		{
   435			BIT(FLOW_ACTION_DROP),
   436			0,
   437			FILTER_ACTION_TYPE_ACL
   438		}
   439	};
   440	
   441	static struct enetc_psfp epsfp = {
   442		.psfp_sfi_bitmap = NULL,
   443	};
   444	
   445	static LIST_HEAD(enetc_block_cb_list);
   446	
   447	static inline int enetc_get_port(struct enetc_ndev_priv *priv)
   448	{
   449		return priv->si->pdev->devfn & 0x7;
   450	}
   451	
   452	/* Stream Identity Entry Set Descriptor */
   453	static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv,
   454					 struct enetc_streamid *sid,
   455					 u8 enable)
   456	{
   457		struct enetc_cbd cbd = {.cmd = 0};
   458		struct streamid_data *si_data;
   459		struct streamid_conf *si_conf;
   460		u16 data_size;
   461		dma_addr_t dma;
   462		int err;
   463	
   464		if (sid->index >= priv->psfp_cap.max_streamid)
   465			return -EINVAL;
   466	
   467		if (sid->filtertype != STREAMID_TYPE_NULL &&
   468		    sid->filtertype != STREAMID_TYPE_SMAC)
   469			return -EOPNOTSUPP;
   470	
   471		/* Disable operation before enable */
   472		cbd.index = cpu_to_le16((u16)sid->index);
   473		cbd.cls = BDCR_CMD_STREAM_IDENTIFY;
   474		cbd.status_flags = 0;
   475	
   476		data_size = sizeof(struct streamid_data);
   477		si_data = kzalloc(data_size, __GFP_DMA | GFP_KERNEL);
   478		cbd.length = cpu_to_le16(data_size);
   479	
   480		dma = dma_map_single(&priv->si->pdev->dev, si_data,
   481				     data_size, DMA_FROM_DEVICE);
   482		if (dma_mapping_error(&priv->si->pdev->dev, dma)) {
   483			netdev_err(priv->si->ndev, "DMA mapping failed!\n");
   484			kfree(si_data);
   485			return -ENOMEM;
   486		}
   487	
 > 488		cbd.addr[0] = lower_32_bits(dma);
   489		cbd.addr[1] = upper_32_bits(dma);
   490		memset(si_data->dmac, 0xff, ETH_ALEN);
 > 491		si_data->vid_vidm_tg =
   492			cpu_to_le16(ENETC_CBDR_SID_VID_MASK
   493				    + ((0x3 << 14) | ENETC_CBDR_SID_VIDM));
   494	
   495		si_conf = &cbd.sid_set;
   496		/* Only one port supported for one entry, set itself */
 > 497		si_conf->iports = 1 << enetc_get_port(priv);
   498		si_conf->id_type = 1;
   499		si_conf->oui[2] = 0x0;
   500		si_conf->oui[1] = 0x80;
   501		si_conf->oui[0] = 0xC2;
   502	
   503		err = enetc_send_cmd(priv->si, &cbd);
   504		if (err)
   505			return -EINVAL;
   506	
   507		if (!enable) {
   508			kfree(si_data);
   509			return 0;
   510		}
   511	
   512		/* Enable the entry overwrite again incase space flushed by hardware */
   513		memset(&cbd, 0, sizeof(cbd));
   514	
   515		cbd.index = cpu_to_le16((u16)sid->index);
   516		cbd.cmd = 0;
   517		cbd.cls = BDCR_CMD_STREAM_IDENTIFY;
   518		cbd.status_flags = 0;
   519	
   520		si_conf->en = 0x80;
   521		si_conf->stream_handle = cpu_to_le32(sid->handle);
   522		si_conf->iports = 1 << enetc_get_port(priv);
   523		si_conf->id_type = sid->filtertype;
   524		si_conf->oui[2] = 0x0;
   525		si_conf->oui[1] = 0x80;
   526		si_conf->oui[0] = 0xC2;
   527	
   528		memset(si_data, 0, data_size);
   529	
   530		cbd.length = cpu_to_le16(data_size);
   531	
   532		cbd.addr[0] = lower_32_bits(dma);
 > 533		cbd.addr[1] = upper_32_bits(dma);
   534	
   535		/* VIDM default to be 1.
   536		 * VID Match. If set (b1) then the VID must match, otherwise
   537		 * any VID is considered a match. VIDM setting is only used
   538		 * when TG is set to b01.
   539		 */
   540		if (si_conf->id_type == STREAMID_TYPE_NULL) {
   541			ether_addr_copy(si_data->dmac, sid->dst_mac);
   542			si_data->vid_vidm_tg =
   543			cpu_to_le16((sid->vid & ENETC_CBDR_SID_VID_MASK) +
   544				    ((((u16)(sid->tagged) & 0x3) << 14)
   545				     | ENETC_CBDR_SID_VIDM));
   546		} else if (si_conf->id_type == STREAMID_TYPE_SMAC) {
   547			ether_addr_copy(si_data->smac, sid->src_mac);
   548			si_data->vid_vidm_tg =
   549			cpu_to_le16((sid->vid & ENETC_CBDR_SID_VID_MASK) +
   550				    ((((u16)(sid->tagged) & 0x3) << 14)
   551				     | ENETC_CBDR_SID_VIDM));
   552		}
   553	
   554		err = enetc_send_cmd(priv->si, &cbd);
   555		kfree(si_data);
   556	
   557		return err;
   558	}
   559	
   560	/* Stream Filter Instance Set Descriptor */
   561	static int enetc_streamfilter_hw_set(struct enetc_ndev_priv *priv,
   562					     struct enetc_psfp_filter *sfi,
   563					     u8 enable)
   564	{
   565		struct enetc_cbd cbd = {.cmd = 0};
   566		struct sfi_conf *sfi_config;
   567	
   568		cbd.index = cpu_to_le16(sfi->index);
   569		cbd.cls = BDCR_CMD_STREAM_FILTER;
   570		cbd.status_flags = 0x80;
   571		cbd.length = cpu_to_le16(1);
   572	
   573		sfi_config = &cbd.sfi_conf;
   574		if (!enable)
   575			goto exit;
   576	
   577		sfi_config->en = 0x80;
   578	
   579		if (sfi->handle >= 0) {
   580			sfi_config->stream_handle =
   581				cpu_to_le32(sfi->handle);
   582			sfi_config->sthm |= 0x80;
   583		}
   584	
   585		sfi_config->sg_inst_table_index = cpu_to_le16(sfi->gate_id);
 > 586		sfi_config->input_ports = 1 << enetc_get_port(priv);
   587	
   588		/* The priority value which may be matched against the
   589		 * frame’s priority value to determine a match for this entry.
   590		 */
   591		if (sfi->prio >= 0)
   592			sfi_config->multi |= (sfi->prio & 0x7) | 0x8;
   593	
   594		/* Filter Type. Identifies the contents of the MSDU/FM_INST_INDEX
   595		 * field as being either an MSDU value or an index into the Flow
   596		 * Meter Instance table.
   597		 * TODO: no limit max sdu
   598		 */
   599	
   600		if (sfi->meter_id >= 0) {
   601			sfi_config->fm_inst_table_index = cpu_to_le16(sfi->meter_id);
   602			sfi_config->multi |= 0x80;
   603		}
   604	
   605	exit:
   606		return enetc_send_cmd(priv->si, &cbd);
   607	}
   608	
   609	static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv,
   610					      u32 index,
   611					      struct psfp_streamfilter_counters *cnt)
   612	{
   613		struct enetc_cbd cbd = { .cmd = 2 };
   614		struct sfi_counter_data *data_buf;
   615		dma_addr_t dma;
   616		u16 data_size;
   617		int err;
   618	
   619		cbd.index = cpu_to_le16((u16)index);
   620		cbd.cmd = 2;
   621		cbd.cls = BDCR_CMD_STREAM_FILTER;
   622		cbd.status_flags = 0;
   623	
   624		data_size = sizeof(struct sfi_counter_data);
   625		data_buf = kzalloc(data_size, __GFP_DMA | GFP_KERNEL);
   626		if (!data_buf)
   627			return -ENOMEM;
   628	
   629		dma = dma_map_single(&priv->si->pdev->dev, data_buf,
   630				     data_size, DMA_FROM_DEVICE);
   631		if (dma_mapping_error(&priv->si->pdev->dev, dma)) {
   632			netdev_err(priv->si->ndev, "DMA mapping failed!\n");
   633			err = -ENOMEM;
   634			goto exit;
   635		}
   636		cbd.addr[0] = lower_32_bits(dma);
   637		cbd.addr[1] = upper_32_bits(dma);
   638	
   639		cbd.length = cpu_to_le16(data_size);
   640	
   641		err = enetc_send_cmd(priv->si, &cbd);
   642		if (err)
   643			goto exit;
   644	
   645		cnt->matching_frames_count =
 > 646				((u64)le32_to_cpu(data_buf->matchh) << 32)
   647				+ data_buf->matchl;
   648	
   649		cnt->not_passing_sdu_count =
   650				((u64)le32_to_cpu(data_buf->msdu_droph) << 32)
   651				+ data_buf->msdu_dropl;
   652	
   653		cnt->passing_sdu_count = cnt->matching_frames_count
   654					- cnt->not_passing_sdu_count;
   655	
   656		cnt->not_passing_frames_count =
   657			((u64)le32_to_cpu(data_buf->stream_gate_droph) << 32)
   658			+ le32_to_cpu(data_buf->stream_gate_dropl);
   659	
   660		cnt->passing_frames_count = cnt->matching_frames_count
   661					- cnt->not_passing_sdu_count
   662					- cnt->not_passing_frames_count;
   663	
   664		cnt->red_frames_count =
   665			((u64)le32_to_cpu(data_buf->flow_meter_droph) << 32)
 > 666			+ le32_to_cpu(data_buf->flow_meter_dropl);
   667	
   668	exit:
   669		kfree(data_buf);
   670		return err;
   671	}
   672	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ