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: <201805260515.NN1ix0qg%fengguang.wu@intel.com>
Date:   Sat, 26 May 2018 05:36:25 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Greg Thelen <gthelen@...gle.com>
Cc:     kbuild-all@...org, linux-kernel@...r.kernel.org,
        Doug Ledford <dledford@...hat.com>
Subject: net/9p/trans_rdma.c:551: undefined reference to `rdma_disconnect'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   62d18ecfa64137349fac9c5817784fbd48b54f48
commit: 9533b292a7acc62c294ebcbd9e1f9f9d52adb10b IB: remove redundant INFINIBAND kconfig dependencies
date:   2 weeks ago
config: x86_64-randconfig-x003-05251014 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
        git checkout 9533b292a7acc62c294ebcbd9e1f9f9d52adb10b
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/9p/trans_rdma.o: In function `rdma_request':
>> net/9p/trans_rdma.c:551: undefined reference to `rdma_disconnect'
   net/9p/trans_rdma.o: In function `rdma_destroy_trans':
>> net/9p/trans_rdma.c:383: undefined reference to `ib_destroy_qp'
>> net/9p/trans_rdma.c:386: undefined reference to `ib_dealloc_pd'
>> net/9p/trans_rdma.c:389: undefined reference to `ib_free_cq'
>> net/9p/trans_rdma.c:392: undefined reference to `rdma_destroy_id'
   net/9p/trans_rdma.o: In function `rdma_close':
   net/9p/trans_rdma.c:569: undefined reference to `rdma_disconnect'
   net/9p/trans_rdma.o: In function `p9_cm_event_handler':
   net/9p/trans_rdma.c:298: undefined reference to `rdma_disconnect'
   net/9p/trans_rdma.o: In function `rdma_create_trans':
>> net/9p/trans_rdma.c:660: undefined reference to `__rdma_create_id'
   net/9p/trans_rdma.o: In function `p9_rdma_bind_privport':
>> net/9p/trans_rdma.c:627: undefined reference to `rdma_bind_addr'
   net/9p/trans_rdma.o: In function `rdma_create_trans':
>> net/9p/trans_rdma.c:682: undefined reference to `rdma_resolve_addr'
>> net/9p/trans_rdma.c:692: undefined reference to `rdma_resolve_route'
>> net/9p/trans_rdma.c:700: undefined reference to `__ib_alloc_cq'
>> net/9p/trans_rdma.c:707: undefined reference to `__ib_alloc_pd'
>> net/9p/trans_rdma.c:723: undefined reference to `rdma_create_qp'
>> net/9p/trans_rdma.c:734: undefined reference to `rdma_connect'

vim +551 net/9p/trans_rdma.c

fc79d4b1 Tom Tucker         2008-10-22  376  
fc79d4b1 Tom Tucker         2008-10-22  377  static void rdma_destroy_trans(struct p9_trans_rdma *rdma)
fc79d4b1 Tom Tucker         2008-10-22  378  {
fc79d4b1 Tom Tucker         2008-10-22  379  	if (!rdma)
fc79d4b1 Tom Tucker         2008-10-22  380  		return;
fc79d4b1 Tom Tucker         2008-10-22  381  
fc79d4b1 Tom Tucker         2008-10-22  382  	if (rdma->qp && !IS_ERR(rdma->qp))
fc79d4b1 Tom Tucker         2008-10-22 @383  		ib_destroy_qp(rdma->qp);
fc79d4b1 Tom Tucker         2008-10-22  384  
fc79d4b1 Tom Tucker         2008-10-22  385  	if (rdma->pd && !IS_ERR(rdma->pd))
fc79d4b1 Tom Tucker         2008-10-22 @386  		ib_dealloc_pd(rdma->pd);
fc79d4b1 Tom Tucker         2008-10-22  387  
fc79d4b1 Tom Tucker         2008-10-22  388  	if (rdma->cq && !IS_ERR(rdma->cq))
7cf20fc6 Christoph Hellwig  2016-03-03 @389  		ib_free_cq(rdma->cq);
fc79d4b1 Tom Tucker         2008-10-22  390  
fc79d4b1 Tom Tucker         2008-10-22  391  	if (rdma->cm_id && !IS_ERR(rdma->cm_id))
fc79d4b1 Tom Tucker         2008-10-22 @392  		rdma_destroy_id(rdma->cm_id);
fc79d4b1 Tom Tucker         2008-10-22  393  
fc79d4b1 Tom Tucker         2008-10-22  394  	kfree(rdma);
fc79d4b1 Tom Tucker         2008-10-22  395  }
fc79d4b1 Tom Tucker         2008-10-22  396  
fc79d4b1 Tom Tucker         2008-10-22  397  static int
fc79d4b1 Tom Tucker         2008-10-22  398  post_recv(struct p9_client *client, struct p9_rdma_context *c)
fc79d4b1 Tom Tucker         2008-10-22  399  {
fc79d4b1 Tom Tucker         2008-10-22  400  	struct p9_trans_rdma *rdma = client->trans;
fc79d4b1 Tom Tucker         2008-10-22  401  	struct ib_recv_wr wr, *bad_wr;
fc79d4b1 Tom Tucker         2008-10-22  402  	struct ib_sge sge;
fc79d4b1 Tom Tucker         2008-10-22  403  
fc79d4b1 Tom Tucker         2008-10-22  404  	c->busa = ib_dma_map_single(rdma->cm_id->device,
fc79d4b1 Tom Tucker         2008-10-22  405  				    c->rc->sdata, client->msize,
fc79d4b1 Tom Tucker         2008-10-22  406  				    DMA_FROM_DEVICE);
fc79d4b1 Tom Tucker         2008-10-22  407  	if (ib_dma_mapping_error(rdma->cm_id->device, c->busa))
fc79d4b1 Tom Tucker         2008-10-22  408  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  409  
7cf20fc6 Christoph Hellwig  2016-03-03  410  	c->cqe.done = recv_done;
7cf20fc6 Christoph Hellwig  2016-03-03  411  
fc79d4b1 Tom Tucker         2008-10-22  412  	sge.addr = c->busa;
fc79d4b1 Tom Tucker         2008-10-22  413  	sge.length = client->msize;
2f31fa88 Jason Gunthorpe    2015-07-30  414  	sge.lkey = rdma->pd->local_dma_lkey;
fc79d4b1 Tom Tucker         2008-10-22  415  
fc79d4b1 Tom Tucker         2008-10-22  416  	wr.next = NULL;
7cf20fc6 Christoph Hellwig  2016-03-03  417  	wr.wr_cqe = &c->cqe;
fc79d4b1 Tom Tucker         2008-10-22  418  	wr.sg_list = &sge;
fc79d4b1 Tom Tucker         2008-10-22  419  	wr.num_sge = 1;
fc79d4b1 Tom Tucker         2008-10-22  420  	return ib_post_recv(rdma->qp, &wr, &bad_wr);
fc79d4b1 Tom Tucker         2008-10-22  421  
fc79d4b1 Tom Tucker         2008-10-22  422   error:
5d385153 Joe Perches        2011-11-28  423  	p9_debug(P9_DEBUG_ERROR, "EIO\n");
fc79d4b1 Tom Tucker         2008-10-22  424  	return -EIO;
fc79d4b1 Tom Tucker         2008-10-22  425  }
fc79d4b1 Tom Tucker         2008-10-22  426  
fc79d4b1 Tom Tucker         2008-10-22  427  static int rdma_request(struct p9_client *client, struct p9_req_t *req)
fc79d4b1 Tom Tucker         2008-10-22  428  {
fc79d4b1 Tom Tucker         2008-10-22  429  	struct p9_trans_rdma *rdma = client->trans;
fc79d4b1 Tom Tucker         2008-10-22  430  	struct ib_send_wr wr, *bad_wr;
fc79d4b1 Tom Tucker         2008-10-22  431  	struct ib_sge sge;
fc79d4b1 Tom Tucker         2008-10-22  432  	int err = 0;
fc79d4b1 Tom Tucker         2008-10-22  433  	unsigned long flags;
fc79d4b1 Tom Tucker         2008-10-22  434  	struct p9_rdma_context *c = NULL;
fc79d4b1 Tom Tucker         2008-10-22  435  	struct p9_rdma_context *rpl_context = NULL;
fc79d4b1 Tom Tucker         2008-10-22  436  
1cff3306 Simon Derr         2013-06-21  437  	/* When an error occurs between posting the recv and the send,
1cff3306 Simon Derr         2013-06-21  438  	 * there will be a receive context posted without a pending request.
1cff3306 Simon Derr         2013-06-21  439  	 * Since there is no way to "un-post" it, we remember it and skip
1cff3306 Simon Derr         2013-06-21  440  	 * post_recv() for the next request.
1cff3306 Simon Derr         2013-06-21  441  	 * So here,
1cff3306 Simon Derr         2013-06-21  442  	 * see if we are this `next request' and need to absorb an excess rc.
1cff3306 Simon Derr         2013-06-21  443  	 * If yes, then drop and free our own, and do not recv_post().
1cff3306 Simon Derr         2013-06-21  444  	 **/
1cff3306 Simon Derr         2013-06-21  445  	if (unlikely(atomic_read(&rdma->excess_rc) > 0)) {
1cff3306 Simon Derr         2013-06-21  446  		if ((atomic_sub_return(1, &rdma->excess_rc) >= 0)) {
1cff3306 Simon Derr         2013-06-21  447  			/* Got one ! */
1cff3306 Simon Derr         2013-06-21  448  			kfree(req->rc);
1cff3306 Simon Derr         2013-06-21  449  			req->rc = NULL;
1cff3306 Simon Derr         2013-06-21  450  			goto dont_need_post_recv;
1cff3306 Simon Derr         2013-06-21  451  		} else {
1cff3306 Simon Derr         2013-06-21  452  			/* We raced and lost. */
1cff3306 Simon Derr         2013-06-21  453  			atomic_inc(&rdma->excess_rc);
1cff3306 Simon Derr         2013-06-21  454  		}
1cff3306 Simon Derr         2013-06-21  455  	}
1cff3306 Simon Derr         2013-06-21  456  
fc79d4b1 Tom Tucker         2008-10-22  457  	/* Allocate an fcall for the reply */
eeff66ef Aneesh Kumar K.V   2011-03-08  458  	rpl_context = kmalloc(sizeof *rpl_context, GFP_NOFS);
1d6400c7 Davidlohr Bueso    2010-09-13  459  	if (!rpl_context) {
1d6400c7 Davidlohr Bueso    2010-09-13  460  		err = -ENOMEM;
2f52d07c Simon Derr         2013-06-21  461  		goto recv_error;
1d6400c7 Davidlohr Bueso    2010-09-13  462  	}
fc79d4b1 Tom Tucker         2008-10-22  463  	rpl_context->rc = req->rc;
fc79d4b1 Tom Tucker         2008-10-22  464  
fc79d4b1 Tom Tucker         2008-10-22  465  	/*
fc79d4b1 Tom Tucker         2008-10-22  466  	 * Post a receive buffer for this request. We need to ensure
fc79d4b1 Tom Tucker         2008-10-22  467  	 * there is a reply buffer available for every outstanding
fc79d4b1 Tom Tucker         2008-10-22  468  	 * request. A flushed request can result in no reply for an
fc79d4b1 Tom Tucker         2008-10-22  469  	 * outstanding request, so we must keep a count to avoid
fc79d4b1 Tom Tucker         2008-10-22  470  	 * overflowing the RQ.
fc79d4b1 Tom Tucker         2008-10-22  471  	 */
2f52d07c Simon Derr         2013-06-21  472  	if (down_interruptible(&rdma->rq_sem)) {
2f52d07c Simon Derr         2013-06-21  473  		err = -EINTR;
2f52d07c Simon Derr         2013-06-21  474  		goto recv_error;
2f52d07c Simon Derr         2013-06-21  475  	}
fd453d0e Simon Derr         2013-06-21  476  
fc79d4b1 Tom Tucker         2008-10-22  477  	err = post_recv(client, rpl_context);
fd453d0e Simon Derr         2013-06-21  478  	if (err) {
fd453d0e Simon Derr         2013-06-21  479  		p9_debug(P9_DEBUG_FCALL, "POST RECV failed\n");
2f52d07c Simon Derr         2013-06-21  480  		goto recv_error;
fd453d0e Simon Derr         2013-06-21  481  	}
fc79d4b1 Tom Tucker         2008-10-22  482  	/* remove posted receive buffer from request structure */
fc79d4b1 Tom Tucker         2008-10-22  483  	req->rc = NULL;
fc79d4b1 Tom Tucker         2008-10-22  484  
1cff3306 Simon Derr         2013-06-21  485  dont_need_post_recv:
fc79d4b1 Tom Tucker         2008-10-22  486  	/* Post the request */
eeff66ef Aneesh Kumar K.V   2011-03-08  487  	c = kmalloc(sizeof *c, GFP_NOFS);
1d6400c7 Davidlohr Bueso    2010-09-13  488  	if (!c) {
1d6400c7 Davidlohr Bueso    2010-09-13  489  		err = -ENOMEM;
2f52d07c Simon Derr         2013-06-21  490  		goto send_error;
1d6400c7 Davidlohr Bueso    2010-09-13  491  	}
fc79d4b1 Tom Tucker         2008-10-22  492  	c->req = req;
fc79d4b1 Tom Tucker         2008-10-22  493  
fc79d4b1 Tom Tucker         2008-10-22  494  	c->busa = ib_dma_map_single(rdma->cm_id->device,
fc79d4b1 Tom Tucker         2008-10-22  495  				    c->req->tc->sdata, c->req->tc->size,
fc79d4b1 Tom Tucker         2008-10-22  496  				    DMA_TO_DEVICE);
2f52d07c Simon Derr         2013-06-21  497  	if (ib_dma_mapping_error(rdma->cm_id->device, c->busa)) {
2f52d07c Simon Derr         2013-06-21  498  		err = -EIO;
2f52d07c Simon Derr         2013-06-21  499  		goto send_error;
2f52d07c Simon Derr         2013-06-21  500  	}
fc79d4b1 Tom Tucker         2008-10-22  501  
7cf20fc6 Christoph Hellwig  2016-03-03  502  	c->cqe.done = send_done;
7cf20fc6 Christoph Hellwig  2016-03-03  503  
fc79d4b1 Tom Tucker         2008-10-22  504  	sge.addr = c->busa;
fc79d4b1 Tom Tucker         2008-10-22  505  	sge.length = c->req->tc->size;
2f31fa88 Jason Gunthorpe    2015-07-30  506  	sge.lkey = rdma->pd->local_dma_lkey;
fc79d4b1 Tom Tucker         2008-10-22  507  
fc79d4b1 Tom Tucker         2008-10-22  508  	wr.next = NULL;
7cf20fc6 Christoph Hellwig  2016-03-03  509  	wr.wr_cqe = &c->cqe;
fc79d4b1 Tom Tucker         2008-10-22  510  	wr.opcode = IB_WR_SEND;
fc79d4b1 Tom Tucker         2008-10-22  511  	wr.send_flags = IB_SEND_SIGNALED;
fc79d4b1 Tom Tucker         2008-10-22  512  	wr.sg_list = &sge;
fc79d4b1 Tom Tucker         2008-10-22  513  	wr.num_sge = 1;
fc79d4b1 Tom Tucker         2008-10-22  514  
2f52d07c Simon Derr         2013-06-21  515  	if (down_interruptible(&rdma->sq_sem)) {
2f52d07c Simon Derr         2013-06-21  516  		err = -EINTR;
2f52d07c Simon Derr         2013-06-21  517  		goto send_error;
2f52d07c Simon Derr         2013-06-21  518  	}
2f52d07c Simon Derr         2013-06-21  519  
3f9d5b8d Simon Derr         2014-03-10  520  	/* Mark request as `sent' *before* we actually send it,
3f9d5b8d Simon Derr         2014-03-10  521  	 * because doing if after could erase the REQ_STATUS_RCVD
3f9d5b8d Simon Derr         2014-03-10  522  	 * status in case of a very fast reply.
3f9d5b8d Simon Derr         2014-03-10  523  	 */
3f9d5b8d Simon Derr         2014-03-10  524  	req->status = REQ_STATUS_SENT;
2f52d07c Simon Derr         2013-06-21  525  	err = ib_post_send(rdma->qp, &wr, &bad_wr);
2f52d07c Simon Derr         2013-06-21  526  	if (err)
2f52d07c Simon Derr         2013-06-21  527  		goto send_error;
fc79d4b1 Tom Tucker         2008-10-22  528  
2f52d07c Simon Derr         2013-06-21  529  	/* Success */
2f52d07c Simon Derr         2013-06-21  530  	return 0;
fc79d4b1 Tom Tucker         2008-10-22  531  
2f52d07c Simon Derr         2013-06-21  532   /* Handle errors that happened during or while preparing the send: */
2f52d07c Simon Derr         2013-06-21  533   send_error:
3f9d5b8d Simon Derr         2014-03-10  534  	req->status = REQ_STATUS_ERROR;
1d6400c7 Davidlohr Bueso    2010-09-13  535  	kfree(c);
2f52d07c Simon Derr         2013-06-21  536  	p9_debug(P9_DEBUG_ERROR, "Error %d in rdma_request()\n", err);
1cff3306 Simon Derr         2013-06-21  537  
1cff3306 Simon Derr         2013-06-21  538  	/* Ach.
1cff3306 Simon Derr         2013-06-21  539  	 *  We did recv_post(), but not send. We have one recv_post in excess.
1cff3306 Simon Derr         2013-06-21  540  	 */
1cff3306 Simon Derr         2013-06-21  541  	atomic_inc(&rdma->excess_rc);
2f52d07c Simon Derr         2013-06-21  542  	return err;
2f52d07c Simon Derr         2013-06-21  543  
2f52d07c Simon Derr         2013-06-21  544   /* Handle errors that happened during or while preparing post_recv(): */
2f52d07c Simon Derr         2013-06-21  545   recv_error:
1d6400c7 Davidlohr Bueso    2010-09-13  546  	kfree(rpl_context);
fc79d4b1 Tom Tucker         2008-10-22  547  	spin_lock_irqsave(&rdma->req_lock, flags);
fc79d4b1 Tom Tucker         2008-10-22  548  	if (rdma->state < P9_RDMA_CLOSING) {
fc79d4b1 Tom Tucker         2008-10-22  549  		rdma->state = P9_RDMA_CLOSING;
fc79d4b1 Tom Tucker         2008-10-22  550  		spin_unlock_irqrestore(&rdma->req_lock, flags);
fc79d4b1 Tom Tucker         2008-10-22 @551  		rdma_disconnect(rdma->cm_id);
fc79d4b1 Tom Tucker         2008-10-22  552  	} else
fc79d4b1 Tom Tucker         2008-10-22  553  		spin_unlock_irqrestore(&rdma->req_lock, flags);
fc79d4b1 Tom Tucker         2008-10-22  554  	return err;
fc79d4b1 Tom Tucker         2008-10-22  555  }
fc79d4b1 Tom Tucker         2008-10-22  556  
fc79d4b1 Tom Tucker         2008-10-22  557  static void rdma_close(struct p9_client *client)
fc79d4b1 Tom Tucker         2008-10-22  558  {
fc79d4b1 Tom Tucker         2008-10-22  559  	struct p9_trans_rdma *rdma;
fc79d4b1 Tom Tucker         2008-10-22  560  
fc79d4b1 Tom Tucker         2008-10-22  561  	if (!client)
fc79d4b1 Tom Tucker         2008-10-22  562  		return;
fc79d4b1 Tom Tucker         2008-10-22  563  
fc79d4b1 Tom Tucker         2008-10-22  564  	rdma = client->trans;
fc79d4b1 Tom Tucker         2008-10-22  565  	if (!rdma)
fc79d4b1 Tom Tucker         2008-10-22  566  		return;
fc79d4b1 Tom Tucker         2008-10-22  567  
fc79d4b1 Tom Tucker         2008-10-22  568  	client->status = Disconnected;
fc79d4b1 Tom Tucker         2008-10-22 @569  	rdma_disconnect(rdma->cm_id);
fc79d4b1 Tom Tucker         2008-10-22  570  	rdma_destroy_trans(rdma);
fc79d4b1 Tom Tucker         2008-10-22  571  }
fc79d4b1 Tom Tucker         2008-10-22  572  
fc79d4b1 Tom Tucker         2008-10-22  573  /**
fc79d4b1 Tom Tucker         2008-10-22  574   * alloc_rdma - Allocate and initialize the rdma transport structure
fc79d4b1 Tom Tucker         2008-10-22  575   * @opts: Mount options structure
fc79d4b1 Tom Tucker         2008-10-22  576   */
fc79d4b1 Tom Tucker         2008-10-22  577  static struct p9_trans_rdma *alloc_rdma(struct p9_rdma_opts *opts)
fc79d4b1 Tom Tucker         2008-10-22  578  {
fc79d4b1 Tom Tucker         2008-10-22  579  	struct p9_trans_rdma *rdma;
fc79d4b1 Tom Tucker         2008-10-22  580  
fc79d4b1 Tom Tucker         2008-10-22  581  	rdma = kzalloc(sizeof(struct p9_trans_rdma), GFP_KERNEL);
fc79d4b1 Tom Tucker         2008-10-22  582  	if (!rdma)
fc79d4b1 Tom Tucker         2008-10-22  583  		return NULL;
fc79d4b1 Tom Tucker         2008-10-22  584  
c4fac910 David Howells      2017-07-05  585  	rdma->port = opts->port;
c4fac910 David Howells      2017-07-05  586  	rdma->privport = opts->privport;
fc79d4b1 Tom Tucker         2008-10-22  587  	rdma->sq_depth = opts->sq_depth;
fc79d4b1 Tom Tucker         2008-10-22  588  	rdma->rq_depth = opts->rq_depth;
fc79d4b1 Tom Tucker         2008-10-22  589  	rdma->timeout = opts->timeout;
fc79d4b1 Tom Tucker         2008-10-22  590  	spin_lock_init(&rdma->req_lock);
fc79d4b1 Tom Tucker         2008-10-22  591  	init_completion(&rdma->cm_done);
fc79d4b1 Tom Tucker         2008-10-22  592  	sema_init(&rdma->sq_sem, rdma->sq_depth);
fd453d0e Simon Derr         2013-06-21  593  	sema_init(&rdma->rq_sem, rdma->rq_depth);
1cff3306 Simon Derr         2013-06-21  594  	atomic_set(&rdma->excess_rc, 0);
fc79d4b1 Tom Tucker         2008-10-22  595  
fc79d4b1 Tom Tucker         2008-10-22  596  	return rdma;
fc79d4b1 Tom Tucker         2008-10-22  597  }
fc79d4b1 Tom Tucker         2008-10-22  598  
fc79d4b1 Tom Tucker         2008-10-22  599  static int rdma_cancel(struct p9_client *client, struct p9_req_t *req)
fc79d4b1 Tom Tucker         2008-10-22  600  {
931700d2 Simon Derr         2014-03-10  601  	/* Nothing to do here.
931700d2 Simon Derr         2014-03-10  602  	 * We will take care of it (if we have to) in rdma_cancelled()
931700d2 Simon Derr         2014-03-10  603  	 */
fc79d4b1 Tom Tucker         2008-10-22  604  	return 1;
fc79d4b1 Tom Tucker         2008-10-22  605  }
fc79d4b1 Tom Tucker         2008-10-22  606  
931700d2 Simon Derr         2014-03-10  607  /* A request has been fully flushed without a reply.
931700d2 Simon Derr         2014-03-10  608   * That means we have posted one buffer in excess.
931700d2 Simon Derr         2014-03-10  609   */
931700d2 Simon Derr         2014-03-10  610  static int rdma_cancelled(struct p9_client *client, struct p9_req_t *req)
931700d2 Simon Derr         2014-03-10  611  {
931700d2 Simon Derr         2014-03-10  612  	struct p9_trans_rdma *rdma = client->trans;
931700d2 Simon Derr         2014-03-10  613  	atomic_inc(&rdma->excess_rc);
931700d2 Simon Derr         2014-03-10  614  	return 0;
931700d2 Simon Derr         2014-03-10  615  }
931700d2 Simon Derr         2014-03-10  616  
f569d3ef Dominique Martinet 2015-01-09  617  static int p9_rdma_bind_privport(struct p9_trans_rdma *rdma)
f569d3ef Dominique Martinet 2015-01-09  618  {
f569d3ef Dominique Martinet 2015-01-09  619  	struct sockaddr_in cl = {
f569d3ef Dominique Martinet 2015-01-09  620  		.sin_family = AF_INET,
f569d3ef Dominique Martinet 2015-01-09  621  		.sin_addr.s_addr = htonl(INADDR_ANY),
f569d3ef Dominique Martinet 2015-01-09  622  	};
f569d3ef Dominique Martinet 2015-01-09  623  	int port, err = -EINVAL;
f569d3ef Dominique Martinet 2015-01-09  624  
f569d3ef Dominique Martinet 2015-01-09  625  	for (port = P9_DEF_MAX_RESVPORT; port >= P9_DEF_MIN_RESVPORT; port--) {
f569d3ef Dominique Martinet 2015-01-09  626  		cl.sin_port = htons((ushort)port);
f569d3ef Dominique Martinet 2015-01-09 @627  		err = rdma_bind_addr(rdma->cm_id, (struct sockaddr *)&cl);
f569d3ef Dominique Martinet 2015-01-09  628  		if (err != -EADDRINUSE)
f569d3ef Dominique Martinet 2015-01-09  629  			break;
f569d3ef Dominique Martinet 2015-01-09  630  	}
f569d3ef Dominique Martinet 2015-01-09  631  	return err;
f569d3ef Dominique Martinet 2015-01-09  632  }
f569d3ef Dominique Martinet 2015-01-09  633  
fc79d4b1 Tom Tucker         2008-10-22  634  /**
fc79d4b1 Tom Tucker         2008-10-22  635   * trans_create_rdma - Transport method for creating atransport instance
fc79d4b1 Tom Tucker         2008-10-22  636   * @client: client instance
fc79d4b1 Tom Tucker         2008-10-22  637   * @addr: IP address string
fc79d4b1 Tom Tucker         2008-10-22  638   * @args: Mount options string
fc79d4b1 Tom Tucker         2008-10-22  639   */
fc79d4b1 Tom Tucker         2008-10-22  640  static int
fc79d4b1 Tom Tucker         2008-10-22  641  rdma_create_trans(struct p9_client *client, const char *addr, char *args)
fc79d4b1 Tom Tucker         2008-10-22  642  {
fc79d4b1 Tom Tucker         2008-10-22  643  	int err;
fc79d4b1 Tom Tucker         2008-10-22  644  	struct p9_rdma_opts opts;
fc79d4b1 Tom Tucker         2008-10-22  645  	struct p9_trans_rdma *rdma;
fc79d4b1 Tom Tucker         2008-10-22  646  	struct rdma_conn_param conn_param;
fc79d4b1 Tom Tucker         2008-10-22  647  	struct ib_qp_init_attr qp_attr;
fc79d4b1 Tom Tucker         2008-10-22  648  
fc79d4b1 Tom Tucker         2008-10-22  649  	/* Parse the transport specific mount options */
fc79d4b1 Tom Tucker         2008-10-22  650  	err = parse_opts(args, &opts);
fc79d4b1 Tom Tucker         2008-10-22  651  	if (err < 0)
fc79d4b1 Tom Tucker         2008-10-22  652  		return err;
fc79d4b1 Tom Tucker         2008-10-22  653  
fc79d4b1 Tom Tucker         2008-10-22  654  	/* Create and initialize the RDMA transport structure */
fc79d4b1 Tom Tucker         2008-10-22  655  	rdma = alloc_rdma(&opts);
fc79d4b1 Tom Tucker         2008-10-22  656  	if (!rdma)
fc79d4b1 Tom Tucker         2008-10-22  657  		return -ENOMEM;
fc79d4b1 Tom Tucker         2008-10-22  658  
fc79d4b1 Tom Tucker         2008-10-22  659  	/* Create the RDMA CM ID */
fa20105e Guy Shapiro        2015-10-22 @660  	rdma->cm_id = rdma_create_id(&init_net, p9_cm_event_handler, client,
fa20105e Guy Shapiro        2015-10-22  661  				     RDMA_PS_TCP, IB_QPT_RC);
fc79d4b1 Tom Tucker         2008-10-22  662  	if (IS_ERR(rdma->cm_id))
fc79d4b1 Tom Tucker         2008-10-22  663  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  664  
517ac45a Tom Tucker         2008-10-23  665  	/* Associate the client with the transport */
517ac45a Tom Tucker         2008-10-23  666  	client->trans = rdma;
517ac45a Tom Tucker         2008-10-23  667  
f569d3ef Dominique Martinet 2015-01-09  668  	/* Bind to a privileged port if we need to */
f569d3ef Dominique Martinet 2015-01-09  669  	if (opts.privport) {
f569d3ef Dominique Martinet 2015-01-09  670  		err = p9_rdma_bind_privport(rdma);
f569d3ef Dominique Martinet 2015-01-09  671  		if (err < 0) {
f569d3ef Dominique Martinet 2015-01-09  672  			pr_err("%s (%d): problem binding to privport: %d\n",
f569d3ef Dominique Martinet 2015-01-09  673  			       __func__, task_pid_nr(current), -err);
f569d3ef Dominique Martinet 2015-01-09  674  			goto error;
f569d3ef Dominique Martinet 2015-01-09  675  		}
f569d3ef Dominique Martinet 2015-01-09  676  	}
f569d3ef Dominique Martinet 2015-01-09  677  
fc79d4b1 Tom Tucker         2008-10-22  678  	/* Resolve the server's address */
fc79d4b1 Tom Tucker         2008-10-22  679  	rdma->addr.sin_family = AF_INET;
fc79d4b1 Tom Tucker         2008-10-22  680  	rdma->addr.sin_addr.s_addr = in_aton(addr);
fc79d4b1 Tom Tucker         2008-10-22  681  	rdma->addr.sin_port = htons(opts.port);
fc79d4b1 Tom Tucker         2008-10-22 @682  	err = rdma_resolve_addr(rdma->cm_id, NULL,
fc79d4b1 Tom Tucker         2008-10-22  683  				(struct sockaddr *)&rdma->addr,
fc79d4b1 Tom Tucker         2008-10-22  684  				rdma->timeout);
fc79d4b1 Tom Tucker         2008-10-22  685  	if (err)
fc79d4b1 Tom Tucker         2008-10-22  686  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  687  	err = wait_for_completion_interruptible(&rdma->cm_done);
fc79d4b1 Tom Tucker         2008-10-22  688  	if (err || (rdma->state != P9_RDMA_ADDR_RESOLVED))
fc79d4b1 Tom Tucker         2008-10-22  689  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  690  
fc79d4b1 Tom Tucker         2008-10-22  691  	/* Resolve the route to the server */
fc79d4b1 Tom Tucker         2008-10-22 @692  	err = rdma_resolve_route(rdma->cm_id, rdma->timeout);
fc79d4b1 Tom Tucker         2008-10-22  693  	if (err)
fc79d4b1 Tom Tucker         2008-10-22  694  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  695  	err = wait_for_completion_interruptible(&rdma->cm_done);
fc79d4b1 Tom Tucker         2008-10-22  696  	if (err || (rdma->state != P9_RDMA_ROUTE_RESOLVED))
fc79d4b1 Tom Tucker         2008-10-22  697  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  698  
fc79d4b1 Tom Tucker         2008-10-22  699  	/* Create the Completion Queue */
7cf20fc6 Christoph Hellwig  2016-03-03 @700  	rdma->cq = ib_alloc_cq(rdma->cm_id->device, client,
7cf20fc6 Christoph Hellwig  2016-03-03  701  			opts.sq_depth + opts.rq_depth + 1,
7cf20fc6 Christoph Hellwig  2016-03-03  702  			0, IB_POLL_SOFTIRQ);
fc79d4b1 Tom Tucker         2008-10-22  703  	if (IS_ERR(rdma->cq))
fc79d4b1 Tom Tucker         2008-10-22  704  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  705  
fc79d4b1 Tom Tucker         2008-10-22  706  	/* Create the Protection Domain */
ed082d36 Christoph Hellwig  2016-09-05 @707  	rdma->pd = ib_alloc_pd(rdma->cm_id->device, 0);
fc79d4b1 Tom Tucker         2008-10-22  708  	if (IS_ERR(rdma->pd))
fc79d4b1 Tom Tucker         2008-10-22  709  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  710  
fc79d4b1 Tom Tucker         2008-10-22  711  	/* Create the Queue Pair */
fc79d4b1 Tom Tucker         2008-10-22  712  	memset(&qp_attr, 0, sizeof qp_attr);
fc79d4b1 Tom Tucker         2008-10-22  713  	qp_attr.event_handler = qp_event_handler;
fc79d4b1 Tom Tucker         2008-10-22  714  	qp_attr.qp_context = client;
fc79d4b1 Tom Tucker         2008-10-22  715  	qp_attr.cap.max_send_wr = opts.sq_depth;
fc79d4b1 Tom Tucker         2008-10-22  716  	qp_attr.cap.max_recv_wr = opts.rq_depth;
fc79d4b1 Tom Tucker         2008-10-22  717  	qp_attr.cap.max_send_sge = P9_RDMA_SEND_SGE;
fc79d4b1 Tom Tucker         2008-10-22  718  	qp_attr.cap.max_recv_sge = P9_RDMA_RECV_SGE;
fc79d4b1 Tom Tucker         2008-10-22  719  	qp_attr.sq_sig_type = IB_SIGNAL_REQ_WR;
fc79d4b1 Tom Tucker         2008-10-22  720  	qp_attr.qp_type = IB_QPT_RC;
fc79d4b1 Tom Tucker         2008-10-22  721  	qp_attr.send_cq = rdma->cq;
fc79d4b1 Tom Tucker         2008-10-22  722  	qp_attr.recv_cq = rdma->cq;
fc79d4b1 Tom Tucker         2008-10-22 @723  	err = rdma_create_qp(rdma->cm_id, rdma->pd, &qp_attr);
fc79d4b1 Tom Tucker         2008-10-22  724  	if (err)
fc79d4b1 Tom Tucker         2008-10-22  725  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  726  	rdma->qp = rdma->cm_id->qp;
fc79d4b1 Tom Tucker         2008-10-22  727  
fc79d4b1 Tom Tucker         2008-10-22  728  	/* Request a connection */
fc79d4b1 Tom Tucker         2008-10-22  729  	memset(&conn_param, 0, sizeof(conn_param));
fc79d4b1 Tom Tucker         2008-10-22  730  	conn_param.private_data = NULL;
fc79d4b1 Tom Tucker         2008-10-22  731  	conn_param.private_data_len = 0;
fc79d4b1 Tom Tucker         2008-10-22  732  	conn_param.responder_resources = P9_RDMA_IRD;
fc79d4b1 Tom Tucker         2008-10-22  733  	conn_param.initiator_depth = P9_RDMA_ORD;
fc79d4b1 Tom Tucker         2008-10-22 @734  	err = rdma_connect(rdma->cm_id, &conn_param);
fc79d4b1 Tom Tucker         2008-10-22  735  	if (err)
fc79d4b1 Tom Tucker         2008-10-22  736  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  737  	err = wait_for_completion_interruptible(&rdma->cm_done);
fc79d4b1 Tom Tucker         2008-10-22  738  	if (err || (rdma->state != P9_RDMA_CONNECTED))
fc79d4b1 Tom Tucker         2008-10-22  739  		goto error;
fc79d4b1 Tom Tucker         2008-10-22  740  
fc79d4b1 Tom Tucker         2008-10-22  741  	client->status = Connected;
fc79d4b1 Tom Tucker         2008-10-22  742  
fc79d4b1 Tom Tucker         2008-10-22  743  	return 0;
fc79d4b1 Tom Tucker         2008-10-22  744  
fc79d4b1 Tom Tucker         2008-10-22  745  error:
fc79d4b1 Tom Tucker         2008-10-22  746  	rdma_destroy_trans(rdma);
fc79d4b1 Tom Tucker         2008-10-22  747  	return -ENOTCONN;
fc79d4b1 Tom Tucker         2008-10-22  748  }
fc79d4b1 Tom Tucker         2008-10-22  749  

:::::: The code at line 551 was first introduced by commit
:::::: fc79d4b104f0eb8c2a7242150eaf8756ced4c344 9p: rdma: RDMA Transport Support for 9P

:::::: TO: Tom Tucker <tom@...ngridcomputing.com>
:::::: CC: Eric Van Hensbergen <ericvh@...eron.(none)>

---
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" (36271 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ