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: <VI1PR0502MB3008C7EE53D450B68FB212E3D12A0@VI1PR0502MB3008.eurprd05.prod.outlook.com>
Date:   Fri, 27 Jul 2018 05:03:10 +0000
From:   Parav Pandit <parav@...lanox.com>
To:     Stephen Rothwell <sfr@...b.auug.org.au>,
        Jason Gunthorpe <jgg@...lanox.com>
CC:     David Miller <davem@...emloft.net>,
        Networking <netdev@...r.kernel.org>,
        Doug Ledford <dledford@...hat.com>,
        Linux-Next Mailing List <linux-next@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Ursula Braun <ubraun@...ux.ibm.com>,
        Leon Romanovsky <leonro@...lanox.com>,
        "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>
Subject: RE: linux-next: manual merge of the net-next tree with the rdma tree



> -----Original Message-----
> From: linux-rdma-owner@...r.kernel.org <linux-rdma-owner@...r.kernel.org>
> On Behalf Of Stephen Rothwell
> Sent: Thursday, July 26, 2018 10:45 PM
> To: Jason Gunthorpe <jgg@...lanox.com>
> Cc: David Miller <davem@...emloft.net>; Networking
> <netdev@...r.kernel.org>; Doug Ledford <dledford@...hat.com>; Linux-Next
> Mailing List <linux-next@...r.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@...r.kernel.org>; Parav Pandit <parav@...lanox.com>; Ursula Braun
> <ubraun@...ux.ibm.com>; Leon Romanovsky <leonro@...lanox.com>; linux-
> rdma@...r.kernel.org
> Subject: Re: linux-next: manual merge of the net-next tree with the rdma tree
> 
> Hi all,
> 
> On Fri, 27 Jul 2018 13:28:47 +1000 Stephen Rothwell <sfr@...b.auug.org.au>
> wrote:
> >
> > I applied this merge fix patch:
> 
> The final conflict resolution actually looks like this:
> 
> (the rdma tree changes to net/smc/smc_core.c are dropped)
> 
> c1d4bb2af93573ee4a21538a1a97b568a2344499
> diff --cc net/smc/smc_ib.c
> index 74f29f814ec1,2cc64bc8ae20..debc6e44f738
> --- a/net/smc/smc_ib.c
> +++ b/net/smc/smc_ib.c
> @@@ -144,6 -142,93 +143,95 @@@ out
>   	return rc;
>   }
> 
> + static int smc_ib_fill_mac(struct smc_ib_device *smcibdev, u8 ibport)
> + {
>  -	struct ib_gid_attr gattr;
>  -	union ib_gid gid;
>  -	int rc;
> ++	const struct ib_gid_attr *gattr;
> ++	int rc = 0;
> +
>  -	rc = ib_query_gid(smcibdev->ibdev, ibport, 0, &gid, &gattr);
>  -	if (rc || !gattr.ndev)
>  -		return -ENODEV;
> ++	gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, 0);
> ++	if (IS_ERR(gattr))
> ++		return PTR_ERR(gattr);
> ++	if (!gattr->ndev) {
> ++		rc = -ENODEV;
> ++		goto done;
> ++	}
> +
>  -	memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN);
>  -	dev_put(gattr.ndev);
>  -	return 0;
> ++	memcpy(smcibdev->mac[ibport - 1], gattr->ndev->dev_addr,
> ETH_ALEN);
> ++done:
> ++	rdma_put_gid_attr(gattr);
> ++	return rc;
> + }
> +
> + /* Create an identifier unique for this instance of SMC-R.
> +  * The MAC-address of the first active registered IB device
> +  * plus a random 2-byte number is used to create this identifier.
> +  * This name is delivered to the peer during connection initialization.
> +  */
> + static inline void smc_ib_define_local_systemid(struct smc_ib_device
> *smcibdev,
> + 						u8 ibport)
> + {
> + 	memcpy(&local_systemid[2], &smcibdev->mac[ibport - 1],
> + 	       sizeof(smcibdev->mac[ibport - 1]));
> + 	get_random_bytes(&local_systemid[0], 2); }
> +
> + bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport) {
> + 	return smcibdev->pattr[ibport - 1].state == IB_PORT_ACTIVE; }
> +
> + /* determine the gid for an ib-device port and vlan id */ int
> + smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
> + 			 unsigned short vlan_id, u8 gid[], u8 *sgid_index) {
>  -	struct ib_gid_attr gattr;
>  -	union ib_gid _gid;
> ++	const struct ib_gid_attr *gattr;
> + 	int i;
> +
> + 	for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) {
>  -		memset(&_gid, 0, SMC_GID_SIZE);
>  -		memset(&gattr, 0, sizeof(gattr));
>  -		if (ib_query_gid(smcibdev->ibdev, ibport, i, &_gid, &gattr))
> ++		gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, i);
> ++		if (IS_ERR(gattr))
> + 			continue;
>  -		if (!gattr.ndev)
> ++		if (!gattr->ndev)
> + 			continue;
Seeing this updated patch, so for completeness same reply as the previous email.

If (!gattr->ndev) {
	rdma_put_gid_attr(gattr);
	continue;
}
Rest changes above and below looks fine to me.
Thanks for doing it, I am not part of netdev mailing list so didn't see the compile error until this patch came up.

>  -		if (((!vlan_id && !is_vlan_dev(gattr.ndev)) ||
>  -		     (vlan_id && is_vlan_dev(gattr.ndev) &&
>  -		      vlan_dev_vlan_id(gattr.ndev) == vlan_id)) &&
>  -		    gattr.gid_type == IB_GID_TYPE_IB) {
> ++		if (((!vlan_id && !is_vlan_dev(gattr->ndev)) ||
> ++		     (vlan_id && is_vlan_dev(gattr->ndev) &&
> ++		      vlan_dev_vlan_id(gattr->ndev) == vlan_id)) &&
> ++		    gattr->gid_type == IB_GID_TYPE_IB) {
> + 			if (gid)
>  -				memcpy(gid, &_gid, SMC_GID_SIZE);
> ++				memcpy(gid, &gattr->gid, SMC_GID_SIZE);
> + 			if (sgid_index)
> + 				*sgid_index = i;
>  -			dev_put(gattr.ndev);
> ++			rdma_put_gid_attr(gattr);
> + 			return 0;
> + 		}
>  -		dev_put(gattr.ndev);
> ++		rdma_put_gid_attr(gattr);
> + 	}
> + 	return -ENODEV;
> + }
> +
> + static int smc_ib_remember_port_attr(struct smc_ib_device *smcibdev,
> + u8 ibport) {
> + 	int rc;
> +
> + 	memset(&smcibdev->pattr[ibport - 1], 0,
> + 	       sizeof(smcibdev->pattr[ibport - 1]));
> + 	rc = ib_query_port(smcibdev->ibdev, ibport,
> + 			   &smcibdev->pattr[ibport - 1]);
> + 	if (rc)
> + 		goto out;
> + 	/* the SMC protocol requires specification of the RoCE MAC address */
> + 	rc = smc_ib_fill_mac(smcibdev, ibport);
> + 	if (rc)
> + 		goto out;
> + 	if (!strncmp(local_systemid, SMC_LOCAL_SYSTEMID_RESET,
> + 		     sizeof(local_systemid)) &&
> + 	    smc_ib_port_active(smcibdev, ibport))
> + 		/* create unique system identifier */
> + 		smc_ib_define_local_systemid(smcibdev, ibport);
> + out:
> + 	return rc;
> + }
> +
>   /* process context wrapper for might_sleep smc_ib_remember_port_attr */
>   static void smc_ib_port_event_work(struct work_struct *work)
>   {
> 
> --
> Cheers,
> Stephen Rothwell

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ