All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse: expected unsigned int [usertype] val
@ 2020-06-01 13:33 kbuild test robot
  0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2020-06-01 13:33 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 9611 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: "Florian, Fainelli," <f.fainelli@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162
commit: 8b3abe304c5f1057b7bac70fd5576dfa67e3e2b3 net: dsa: bcm_sf2: Support specifying VLAN tag egress rule
date:   9 weeks ago
:::::: branch date: 14 hours ago
:::::: commit date: 9 weeks ago
config: x86_64-randconfig-s022-20200601 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-243-gc100a7ab-dirty
        git checkout 8b3abe304c5f1057b7bac70fd5576dfa67e3e2b3
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

   drivers/net/dsa/bcm_sf2_cfp.c:352:44: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __be16 [usertype] vlan_m_tci @@     got int @@
   drivers/net/dsa/bcm_sf2_cfp.c:352:44: sparse:     expected restricted __be16 [usertype] vlan_m_tci
   drivers/net/dsa/bcm_sf2_cfp.c:352:44: sparse:     got int
   drivers/net/dsa/bcm_sf2_cfp.c:633:43: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __be16 [usertype] vlan_m_tci @@     got int @@
   drivers/net/dsa/bcm_sf2_cfp.c:633:43: sparse:     expected restricted __be16 [usertype] vlan_m_tci
   drivers/net/dsa/bcm_sf2_cfp.c:633:43: sparse:     got int
   drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse: sparse: cast from restricted __be32
   drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] val @@     got restricted __be32 @@
>> drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse:     expected unsigned int [usertype] val
   drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse:     got restricted __be32
   drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse: sparse: cast from restricted __be32
   drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse: sparse: cast from restricted __be32
   drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse: sparse: cast from restricted __be32
   drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse: sparse: cast from restricted __be32
   drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse: sparse: restricted __be32 degrades to integer

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8b3abe304c5f1057b7bac70fd5576dfa67e3e2b3
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout 8b3abe304c5f1057b7bac70fd5576dfa67e3e2b3
vim +890 drivers/net/dsa/bcm_sf2_cfp.c

ba0696c22e7c5b Florian Fainelli 2017-10-20  845  
ce24b08a2e6f7c Florian Fainelli 2018-11-06  846  static int bcm_sf2_cfp_rule_insert(struct dsa_switch *ds, int port,
3306145866b62f Florian Fainelli 2017-10-20  847  				   struct ethtool_rx_flow_spec *fs)
3306145866b62f Florian Fainelli 2017-10-20  848  {
3306145866b62f Florian Fainelli 2017-10-20  849  	struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
68bb8ea8ad0d49 Vivien Didelot   2019-10-21  850  	s8 cpu_port = dsa_to_port(ds, port)->cpu_dp->index;
8a75f4f2acd78a Florian Fainelli 2018-08-07  851  	__u64 ring_cookie = fs->ring_cookie;
8b3abe304c5f10 Florian Fainelli 2020-03-30  852  	struct switchdev_obj_port_vlan vlan;
3306145866b62f Florian Fainelli 2017-10-20  853  	unsigned int queue_num, port_num;
8b3abe304c5f10 Florian Fainelli 2020-03-30  854  	u16 vid;
ce24b08a2e6f7c Florian Fainelli 2018-11-06  855  	int ret;
ae7a5aff783c79 Florian Fainelli 2018-11-06  856  
8a75f4f2acd78a Florian Fainelli 2018-08-07  857  	/* This rule is a Wake-on-LAN filter and we must specifically
8a75f4f2acd78a Florian Fainelli 2018-08-07  858  	 * target the CPU port in order for it to be working.
8a75f4f2acd78a Florian Fainelli 2018-08-07  859  	 */
8a75f4f2acd78a Florian Fainelli 2018-08-07  860  	if (ring_cookie == RX_CLS_FLOW_WAKE)
8a75f4f2acd78a Florian Fainelli 2018-08-07  861  		ring_cookie = cpu_port * SF2_NUM_EGRESS_QUEUES;
8a75f4f2acd78a Florian Fainelli 2018-08-07  862  
3306145866b62f Florian Fainelli 2017-10-20  863  	/* We do not support discarding packets, check that the
3306145866b62f Florian Fainelli 2017-10-20  864  	 * destination port is enabled and that we are within the
3306145866b62f Florian Fainelli 2017-10-20  865  	 * number of ports supported by the switch
3306145866b62f Florian Fainelli 2017-10-20  866  	 */
8a75f4f2acd78a Florian Fainelli 2018-08-07  867  	port_num = ring_cookie / SF2_NUM_EGRESS_QUEUES;
3306145866b62f Florian Fainelli 2017-10-20  868  
8a75f4f2acd78a Florian Fainelli 2018-08-07  869  	if (ring_cookie == RX_CLS_FLOW_DISC ||
2104bc0ab0eee8 Florian Fainelli 2018-08-03  870  	    !(dsa_is_user_port(ds, port_num) ||
2104bc0ab0eee8 Florian Fainelli 2018-08-03  871  	      dsa_is_cpu_port(ds, port_num)) ||
3306145866b62f Florian Fainelli 2017-10-20  872  	    port_num >= priv->hw_params.num_ports)
3306145866b62f Florian Fainelli 2017-10-20  873  		return -EINVAL;
8b3abe304c5f10 Florian Fainelli 2020-03-30  874  
8b3abe304c5f10 Florian Fainelli 2020-03-30  875  	/* If the rule is matching a particular VLAN, make sure that we honor
8b3abe304c5f10 Florian Fainelli 2020-03-30  876  	 * the matching and have it tagged or untagged on the destination port,
8b3abe304c5f10 Florian Fainelli 2020-03-30  877  	 * we do this on egress with a VLAN entry. The egress tagging attribute
8b3abe304c5f10 Florian Fainelli 2020-03-30  878  	 * is expected to be provided in h_ext.data[1] bit 0. A 1 means untagged,
8b3abe304c5f10 Florian Fainelli 2020-03-30  879  	 * a 0 means tagged.
8b3abe304c5f10 Florian Fainelli 2020-03-30  880  	 */
8b3abe304c5f10 Florian Fainelli 2020-03-30  881  	if (fs->flow_type & FLOW_EXT) {
8b3abe304c5f10 Florian Fainelli 2020-03-30  882  		/* We cannot support matching multiple VLAN IDs yet */
8b3abe304c5f10 Florian Fainelli 2020-03-30  883  		if ((be16_to_cpu(fs->m_ext.vlan_tci) & VLAN_VID_MASK) !=
8b3abe304c5f10 Florian Fainelli 2020-03-30  884  		    VLAN_VID_MASK)
8b3abe304c5f10 Florian Fainelli 2020-03-30  885  			return -EINVAL;
8b3abe304c5f10 Florian Fainelli 2020-03-30  886  
8b3abe304c5f10 Florian Fainelli 2020-03-30  887  		vid = be16_to_cpu(fs->h_ext.vlan_tci) & VLAN_VID_MASK;
8b3abe304c5f10 Florian Fainelli 2020-03-30  888  		vlan.vid_begin = vid;
8b3abe304c5f10 Florian Fainelli 2020-03-30  889  		vlan.vid_end = vid;
8b3abe304c5f10 Florian Fainelli 2020-03-30 @890  		if (cpu_to_be32(fs->h_ext.data[1]) & 1)
8b3abe304c5f10 Florian Fainelli 2020-03-30  891  			vlan.flags = BRIDGE_VLAN_INFO_UNTAGGED;
8b3abe304c5f10 Florian Fainelli 2020-03-30  892  		else
8b3abe304c5f10 Florian Fainelli 2020-03-30  893  			vlan.flags = 0;
8b3abe304c5f10 Florian Fainelli 2020-03-30  894  
8b3abe304c5f10 Florian Fainelli 2020-03-30  895  		ret = ds->ops->port_vlan_prepare(ds, port_num, &vlan);
8b3abe304c5f10 Florian Fainelli 2020-03-30  896  		if (ret)
8b3abe304c5f10 Florian Fainelli 2020-03-30  897  			return ret;
8b3abe304c5f10 Florian Fainelli 2020-03-30  898  
8b3abe304c5f10 Florian Fainelli 2020-03-30  899  		ds->ops->port_vlan_add(ds, port_num, &vlan);
8b3abe304c5f10 Florian Fainelli 2020-03-30  900  	}
8b3abe304c5f10 Florian Fainelli 2020-03-30  901  
3306145866b62f Florian Fainelli 2017-10-20  902  	/*
3306145866b62f Florian Fainelli 2017-10-20  903  	 * We have a small oddity where Port 6 just does not have a
3306145866b62f Florian Fainelli 2017-10-20  904  	 * valid bit here (so we substract by one).
3306145866b62f Florian Fainelli 2017-10-20  905  	 */
8a75f4f2acd78a Florian Fainelli 2018-08-07  906  	queue_num = ring_cookie % SF2_NUM_EGRESS_QUEUES;
3306145866b62f Florian Fainelli 2017-10-20  907  	if (port_num >= 7)
3306145866b62f Florian Fainelli 2017-10-20  908  		port_num -= 1;
3306145866b62f Florian Fainelli 2017-10-20  909  
ba0696c22e7c5b Florian Fainelli 2017-10-20  910  	switch (fs->flow_type & ~FLOW_EXT) {
ba0696c22e7c5b Florian Fainelli 2017-10-20  911  	case TCP_V4_FLOW:
ba0696c22e7c5b Florian Fainelli 2017-10-20  912  	case UDP_V4_FLOW:
ba0696c22e7c5b Florian Fainelli 2017-10-20  913  		ret = bcm_sf2_cfp_ipv4_rule_set(priv, port, port_num,
ba0696c22e7c5b Florian Fainelli 2017-10-20  914  						queue_num, fs);
ba0696c22e7c5b Florian Fainelli 2017-10-20  915  		break;
ba0696c22e7c5b Florian Fainelli 2017-10-20  916  	case TCP_V6_FLOW:
ba0696c22e7c5b Florian Fainelli 2017-10-20  917  	case UDP_V6_FLOW:
ba0696c22e7c5b Florian Fainelli 2017-10-20  918  		ret = bcm_sf2_cfp_ipv6_rule_set(priv, port, port_num,
ba0696c22e7c5b Florian Fainelli 2017-10-20  919  						queue_num, fs);
ba0696c22e7c5b Florian Fainelli 2017-10-20  920  		break;
ba0696c22e7c5b Florian Fainelli 2017-10-20  921  	default:
ae7a5aff783c79 Florian Fainelli 2018-11-06  922  		ret = -EINVAL;
ba0696c22e7c5b Florian Fainelli 2017-10-20  923  		break;
ba0696c22e7c5b Florian Fainelli 2017-10-20  924  	}
3306145866b62f Florian Fainelli 2017-10-20  925  
ce24b08a2e6f7c Florian Fainelli 2018-11-06  926  	return ret;
ce24b08a2e6f7c Florian Fainelli 2018-11-06  927  }
ce24b08a2e6f7c Florian Fainelli 2018-11-06  928  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35019 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-01 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 13:33 drivers/net/dsa/bcm_sf2_cfp.c:890:21: sparse: expected unsigned int [usertype] val kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.