Skip to contentSkip to conversation

RDMA/bnxt_re: Remove unused vlan_tag variable

PATCH Applied Leon Romanovsky 3 participants 4 messages Oct 29, 2017 – Nov 13, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/bnxt_re: Remove unused vlan_tag variable

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>

The Broadcom driver produces the following compilation warning

drivers/infiniband/hw/bnxt_re/ib_verbs.c:
In function ‘bnxt_re_create_ah’:
drivers/infiniband/hw/bnxt_re/ib_verbs.c:668:6:

	warning: variable ‘vlan_tag’ set but not used [-Wunused-but-set-variable]
	u16 vlan_tag;

Let's remove it till vlan_tag will be implemented properly.

Cc Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]>
---
 drivers/infiniband/hw/bnxt_re/ib_verbs.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +1 -5
index ebcdfb4f5f75..39e49d0e8467 100644
@@ -665,7 +665,6 @@ struct ib_ah *bnxt_re_create_ah(struct ib_pd *ib_pd,
 	struct bnxt_re_ah *ah;
 	const struct ib_global_route *grh = rdma_ah_read_grh(ah_attr);
 	int rc;
-	u16 vlan_tag;
 	u8 nw_type;
 
 	struct ib_gid_attr sgid_attr;
@@ -711,11 +710,8 @@ struct ib_ah *bnxt_re_create_ah(struct ib_pd *ib_pd,
 				grh->sgid_index);
 			goto fail;
 		}
-		if (sgid_attr.ndev) {
-			if (is_vlan_dev(sgid_attr.ndev))
-				vlan_tag = vlan_dev_vlan_id(sgid_attr.ndev);
+		if (sgid_attr.ndev)
 			dev_put(sgid_attr.ndev);
-		}
 		/* Get network header type for this GID */
 		nw_type = ib_gid_to_network_type(sgid_attr.gid_type, &sgid);
 		switch (nw_type) {

--
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to a message not in the archive
I love your patch! Yet something to improve:

Hi Leon,

I love your patch! Yet something to improve:

[auto build test ERROR on rdma/master]
[also build test ERROR on v4.14-rc7 next-20171018]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Leon-Romanovsky/RDMA-bnxt_re-Remove-unused-vlan_tag-variable/20171031-085111
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git master
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa

All errors (new ones prefixed by >>):

drivers/infiniband/hw/bnxt_re/ib_verbs.c: In function 'bnxt_re_create_ah':

>> drivers/infiniband/hw/bnxt_re/ib_verbs.c:729:30: error: 'vlan_tag' undeclared (first use in this function)
            ah_attr->roce.dmac, &vlan_tag,
                                 ^

drivers/infiniband/hw/bnxt_re/ib_verbs.c:729:30: note: each undeclared identifier is reported only once for each function it appears in

vim +/vlan_tag +729 drivers/infiniband/hw/bnxt_re/ib_verbs.c

1ac5a404 Selvin Xavier               2017-02-10  658  
1ac5a404 Selvin Xavier               2017-02-10  659  struct ib_ah *bnxt_re_create_ah(struct ib_pd *ib_pd,
90898850 Dasaratharaman Chandramouli 2017-04-29  660  				struct rdma_ah_attr *ah_attr,
1ac5a404 Selvin Xavier               2017-02-10  661  				struct ib_udata *udata)
1ac5a404 Selvin Xavier               2017-02-10  662  {
1ac5a404 Selvin Xavier               2017-02-10  663  	struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd);
1ac5a404 Selvin Xavier               2017-02-10  664  	struct bnxt_re_dev *rdev = pd->rdev;
1ac5a404 Selvin Xavier               2017-02-10  665  	struct bnxt_re_ah *ah;
d8966fcd Dasaratharaman Chandramouli 2017-04-29  666  	const struct ib_global_route *grh = rdma_ah_read_grh(ah_attr);
1ac5a404 Selvin Xavier               2017-02-10  667  	int rc;
1ac5a404 Selvin Xavier               2017-02-10  668  	u8 nw_type;
1ac5a404 Selvin Xavier               2017-02-10  669  
1ac5a404 Selvin Xavier               2017-02-10  670  	struct ib_gid_attr sgid_attr;
1ac5a404 Selvin Xavier               2017-02-10  671  
d8966fcd Dasaratharaman Chandramouli 2017-04-29  672  	if (!(rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH)) {
1ac5a404 Selvin Xavier               2017-02-10  673  		dev_err(rdev_to_dev(rdev), "Failed to alloc AH: GRH not set");
1ac5a404 Selvin Xavier               2017-02-10  674  		return ERR_PTR(-EINVAL);
1ac5a404 Selvin Xavier               2017-02-10  675  	}
1ac5a404 Selvin Xavier               2017-02-10  676  	ah = kzalloc(sizeof(*ah), GFP_ATOMIC);
1ac5a404 Selvin Xavier               2017-02-10  677  	if (!ah)
1ac5a404 Selvin Xavier               2017-02-10  678  		return ERR_PTR(-ENOMEM);
1ac5a404 Selvin Xavier               2017-02-10  679  
1ac5a404 Selvin Xavier               2017-02-10  680  	ah->rdev = rdev;
1ac5a404 Selvin Xavier               2017-02-10  681  	ah->qplib_ah.pd = &pd->qplib_pd;
1ac5a404 Selvin Xavier               2017-02-10  682  
1ac5a404 Selvin Xavier               2017-02-10  683  	/* Supply the configuration for the HW */
d8966fcd Dasaratharaman Chandramouli 2017-04-29  684  	memcpy(ah->qplib_ah.dgid.data, grh->dgid.raw,
1ac5a404 Selvin Xavier               2017-02-10  685  	       sizeof(union ib_gid));
1ac5a404 Selvin Xavier               2017-02-10  686  	/*
1ac5a404 Selvin Xavier               2017-02-10  687  	 * If RoCE V2 is enabled, stack will have two entries for
1ac5a404 Selvin Xavier               2017-02-10  688  	 * each GID entry. Avoiding this duplicte entry in HW. Dividing
1ac5a404 Selvin Xavier               2017-02-10  689  	 * the GID index by 2 for RoCE V2
1ac5a404 Selvin Xavier               2017-02-10  690  	 */
d8966fcd Dasaratharaman Chandramouli 2017-04-29  691  	ah->qplib_ah.sgid_index = grh->sgid_index / 2;
d8966fcd Dasaratharaman Chandramouli 2017-04-29  692  	ah->qplib_ah.host_sgid_index = grh->sgid_index;
d8966fcd Dasaratharaman Chandramouli 2017-04-29  693  	ah->qplib_ah.traffic_class = grh->traffic_class;
d8966fcd Dasaratharaman Chandramouli 2017-04-29  694  	ah->qplib_ah.flow_label = grh->flow_label;
d8966fcd Dasaratharaman Chandramouli 2017-04-29  695  	ah->qplib_ah.hop_limit = grh->hop_limit;
d8966fcd Dasaratharaman Chandramouli 2017-04-29  696  	ah->qplib_ah.sl = rdma_ah_get_sl(ah_attr);
1ac5a404 Selvin Xavier               2017-02-10  697  	if (ib_pd->uobject &&
1ac5a404 Selvin Xavier               2017-02-10  698  	    !rdma_is_multicast_addr((struct in6_addr *)
d8966fcd Dasaratharaman Chandramouli 2017-04-29  699  				    grh->dgid.raw) &&
1ac5a404 Selvin Xavier               2017-02-10  700  	    !rdma_link_local_addr((struct in6_addr *)
d8966fcd Dasaratharaman Chandramouli 2017-04-29  701  				  grh->dgid.raw)) {
1ac5a404 Selvin Xavier               2017-02-10  702  		union ib_gid sgid;
1ac5a404 Selvin Xavier               2017-02-10  703  
1ac5a404 Selvin Xavier               2017-02-10  704  		rc = ib_get_cached_gid(&rdev->ibdev, 1,
d8966fcd Dasaratharaman Chandramouli 2017-04-29  705  				       grh->sgid_index, &sgid,
1ac5a404 Selvin Xavier               2017-02-10  706  				       &sgid_attr);
1ac5a404 Selvin Xavier               2017-02-10  707  		if (rc) {
1ac5a404 Selvin Xavier               2017-02-10  708  			dev_err(rdev_to_dev(rdev),
1ac5a404 Selvin Xavier               2017-02-10  709  				"Failed to query gid at index %d",
d8966fcd Dasaratharaman Chandramouli 2017-04-29  710  				grh->sgid_index);
1ac5a404 Selvin Xavier               2017-02-10  711  			goto fail;
1ac5a404 Selvin Xavier               2017-02-10  712  		}
f3321eaa Leon Romanovsky             2017-10-29  713  		if (sgid_attr.ndev)
1ac5a404 Selvin Xavier               2017-02-10  714  			dev_put(sgid_attr.ndev);
1ac5a404 Selvin Xavier               2017-02-10  715  		/* Get network header type for this GID */
1ac5a404 Selvin Xavier               2017-02-10  716  		nw_type = ib_gid_to_network_type(sgid_attr.gid_type, &sgid);
1ac5a404 Selvin Xavier               2017-02-10  717  		switch (nw_type) {
1ac5a404 Selvin Xavier               2017-02-10  718  		case RDMA_NETWORK_IPV4:
1ac5a404 Selvin Xavier               2017-02-10  719  			ah->qplib_ah.nw_type = CMDQ_CREATE_AH_TYPE_V2IPV4;
1ac5a404 Selvin Xavier               2017-02-10  720  			break;
1ac5a404 Selvin Xavier               2017-02-10  721  		case RDMA_NETWORK_IPV6:
1ac5a404 Selvin Xavier               2017-02-10  722  			ah->qplib_ah.nw_type = CMDQ_CREATE_AH_TYPE_V2IPV6;
1ac5a404 Selvin Xavier               2017-02-10  723  			break;
1ac5a404 Selvin Xavier               2017-02-10  724  		default:
1ac5a404 Selvin Xavier               2017-02-10  725  			ah->qplib_ah.nw_type = CMDQ_CREATE_AH_TYPE_V1;
1ac5a404 Selvin Xavier               2017-02-10  726  			break;
1ac5a404 Selvin Xavier               2017-02-10  727  		}
d8966fcd Dasaratharaman Chandramouli 2017-04-29  728  		rc = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
44c58487 Dasaratharaman Chandramouli 2017-04-29 @729  						  ah_attr->roce.dmac, &vlan_tag,
1ac5a404 Selvin Xavier               2017-02-10  730  						  &sgid_attr.ndev->ifindex,
1ac5a404 Selvin Xavier               2017-02-10  731  						  NULL);
1ac5a404 Selvin Xavier               2017-02-10  732  		if (rc) {
1ac5a404 Selvin Xavier               2017-02-10  733  			dev_err(rdev_to_dev(rdev), "Failed to get dmac\n");
1ac5a404 Selvin Xavier               2017-02-10  734  			goto fail;
1ac5a404 Selvin Xavier               2017-02-10  735  		}
1ac5a404 Selvin Xavier               2017-02-10  736  	}
1ac5a404 Selvin Xavier               2017-02-10  737  
44c58487 Dasaratharaman Chandramouli 2017-04-29  738  	memcpy(ah->qplib_ah.dmac, ah_attr->roce.dmac, ETH_ALEN);
1ac5a404 Selvin Xavier               2017-02-10  739  	rc = bnxt_qplib_create_ah(&rdev->qplib_res, &ah->qplib_ah);
1ac5a404 Selvin Xavier               2017-02-10  740  	if (rc) {
1ac5a404 Selvin Xavier               2017-02-10  741  		dev_err(rdev_to_dev(rdev), "Failed to allocate HW AH");
1ac5a404 Selvin Xavier               2017-02-10  742  		goto fail;
1ac5a404 Selvin Xavier               2017-02-10  743  	}
1ac5a404 Selvin Xavier               2017-02-10  744  
1ac5a404 Selvin Xavier               2017-02-10  745  	/* Write AVID to shared page. */
1ac5a404 Selvin Xavier               2017-02-10  746  	if (ib_pd->uobject) {
1ac5a404 Selvin Xavier               2017-02-10  747  		struct ib_ucontext *ib_uctx = ib_pd->uobject->context;
1ac5a404 Selvin Xavier               2017-02-10  748  		struct bnxt_re_ucontext *uctx;
1ac5a404 Selvin Xavier               2017-02-10  749  		unsigned long flag;
1ac5a404 Selvin Xavier               2017-02-10  750  		u32 *wrptr;
1ac5a404 Selvin Xavier               2017-02-10  751  
1ac5a404 Selvin Xavier               2017-02-10  752  		uctx = container_of(ib_uctx, struct bnxt_re_ucontext, ib_uctx);
1ac5a404 Selvin Xavier               2017-02-10  753  		spin_lock_irqsave(&uctx->sh_lock, flag);
1ac5a404 Selvin Xavier               2017-02-10  754  		wrptr = (u32 *)(uctx->shpg + BNXT_RE_AVID_OFFT);
1ac5a404 Selvin Xavier               2017-02-10  755  		*wrptr = ah->qplib_ah.id;
1ac5a404 Selvin Xavier               2017-02-10  756  		wmb(); /* make sure cache is updated. */
1ac5a404 Selvin Xavier               2017-02-10  757  		spin_unlock_irqrestore(&uctx->sh_lock, flag);
1ac5a404 Selvin Xavier               2017-02-10  758  	}
1ac5a404 Selvin Xavier               2017-02-10  759  
1ac5a404 Selvin Xavier               2017-02-10  760  	return &ah->ib_ah;
1ac5a404 Selvin Xavier               2017-02-10  761  
1ac5a404 Selvin Xavier               2017-02-10  762  fail:
1ac5a404 Selvin Xavier               2017-02-10  763  	kfree(ah);
1ac5a404 Selvin Xavier               2017-02-10  764  	return ERR_PTR(rc);
1ac5a404 Selvin Xavier               2017-02-10  765  }
1ac5a404 Selvin Xavier               2017-02-10  766  

:::::: The code at line 729 was first introduced by commit
:::::: 44c58487d51a0dc43d96f1dc864f0461ec6a346a IB/core: Define 'ib' and 'roce' rdma_ah_attr types

:::::: TO: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> :::::: CC: Doug Ledford <[email protected]>

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

#4 lore raw
In reply to a message not in the archive
Quoted 10 lines · kbuild test robot

Hi Leon,

I love your patch! Yet something to improve:

[auto build test ERROR on rdma/master]
[also build test ERROR on v4.14-rc7 next-20171018]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Leon-Romanovsky/RDMA-bnxt_re-Remove-unused-vlan_tag-variable/20171031-085111
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git master

It should be against k.o/for-next. There is no rdma_addr_find_l2_eth_by_grh() call there.
https://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git/tree/drivers/infiniband/hw/bnxt_re/ib_verbs.c?h=k.o/for-next#n659

Thanks

Applied
#5 lore raw
In reply to a message not in the archive
Quoted 10 lines · Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>

The Broadcom driver produces the following compilation warning

drivers/infiniband/hw/bnxt_re/ib_verbs.c:
In function ‘bnxt_re_create_ah’:
drivers/infiniband/hw/bnxt_re/ib_verbs.c:668:6:
warning: variable ‘vlan_tag’ set but not used [-Wunused-but-set-variable] u16 vlan_tag;

Quoted 4 lines

Let's remove it till vlan_tag will be implemented properly.

Cc Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]>

Thanks, applied.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD