Deleted Added
full compact
qp.c (346876) qp.c (346923)
1/*
2 * Copyright (c) 2009-2013 Chelsio, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 16 unchanged lines hidden (view full) ---

25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2009-2013 Chelsio, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:

--- 16 unchanged lines hidden (view full) ---

25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c 346876 2019-04-29 04:42:18Z np $");
33__FBSDID("$FreeBSD: stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c 346923 2019-04-29 20:10:28Z np $");
34
35#include "opt_inet.h"
36
37#ifdef TCP_OFFLOAD
38#include <sys/types.h>
39#include <sys/malloc.h>
40#include <sys/socket.h>
41#include <sys/socketvar.h>

--- 16 unchanged lines hidden (view full) ---

58struct rss_header;
59struct cpl_set_tcb_rpl;
60#include <linux/types.h>
61#include "offload.h"
62#include "tom/t4_tom.h"
63
64#include "iw_cxgbe.h"
65#include "user.h"
34
35#include "opt_inet.h"
36
37#ifdef TCP_OFFLOAD
38#include <sys/types.h>
39#include <sys/malloc.h>
40#include <sys/socket.h>
41#include <sys/socketvar.h>

--- 16 unchanged lines hidden (view full) ---

58struct rss_header;
59struct cpl_set_tcb_rpl;
60#include <linux/types.h>
61#include "offload.h"
62#include "tom/t4_tom.h"
63
64#include "iw_cxgbe.h"
65#include "user.h"
66extern int use_dsgl;
66
67static int creds(struct toepcb *toep, struct inpcb *inp, size_t wrsize);
68static int max_fr_immd = T4_MAX_FR_IMMD;//SYSCTL parameter later...
69
70static int alloc_ird(struct c4iw_dev *dev, u32 ird)
71{
72 int ret = 0;
73
74 spin_lock_irq(&dev->lock);

--- 494 unchanged lines hidden (view full) ---

569 struct c4iw_ucontext *ucontext;
570 struct c4iw_qp *qhp;
571 struct c4iw_dev *rhp;
572
573 qhp = container_of(work, struct c4iw_qp, free_work);
574 ucontext = qhp->ucontext;
575 rhp = qhp->rhp;
576
67static int creds(struct toepcb *toep, struct inpcb *inp, size_t wrsize);
68static int max_fr_immd = T4_MAX_FR_IMMD;//SYSCTL parameter later...
69
70static int alloc_ird(struct c4iw_dev *dev, u32 ird)
71{
72 int ret = 0;
73
74 spin_lock_irq(&dev->lock);

--- 494 unchanged lines hidden (view full) ---

569 struct c4iw_ucontext *ucontext;
570 struct c4iw_qp *qhp;
571 struct c4iw_dev *rhp;
572
573 qhp = container_of(work, struct c4iw_qp, free_work);
574 ucontext = qhp->ucontext;
575 rhp = qhp->rhp;
576
577 CTR3(KTR_IW_CXGBE, "%s qhp %p ucontext %p\n", __func__,
577 CTR3(KTR_IW_CXGBE, "%s qhp %p ucontext %p", __func__,
578 qhp, ucontext);
579 destroy_qp(&rhp->rdev, &qhp->wq,
580 ucontext ? &ucontext->uctx : &rhp->rdev.uctx);
581
582 if (ucontext)
583 c4iw_put_ucontext(ucontext);
584 kfree(qhp);
585}

--- 882 unchanged lines hidden (view full) ---

1468 qhp->attr = newattr;
1469 }
1470
1471 if (!(mask & C4IW_QP_ATTR_NEXT_STATE))
1472 goto out;
1473 if (qhp->attr.state == attrs->next_state)
1474 goto out;
1475
578 qhp, ucontext);
579 destroy_qp(&rhp->rdev, &qhp->wq,
580 ucontext ? &ucontext->uctx : &rhp->rdev.uctx);
581
582 if (ucontext)
583 c4iw_put_ucontext(ucontext);
584 kfree(qhp);
585}

--- 882 unchanged lines hidden (view full) ---

1468 qhp->attr = newattr;
1469 }
1470
1471 if (!(mask & C4IW_QP_ATTR_NEXT_STATE))
1472 goto out;
1473 if (qhp->attr.state == attrs->next_state)
1474 goto out;
1475
1476 /* Return EINPROGRESS if QP is already in transition state.
1477 * Eg: CLOSING->IDLE transition or *->ERROR transition.
1478 * This can happen while connection is switching(due to rdma_fini)
1479 * from iWARP/RDDP to TOE mode and any inflight RDMA RX data will
1480 * reach TOE driver -> TCP stack -> iWARP driver. In this way
1481 * iWARP driver keep receiving inflight RDMA RX data until socket
1482 * is closed or aborted. And if iWARP CM is in FPDU sate, then
1483 * it tries to put QP in TERM state and disconnects endpoint.
1484 * But as QP is already in transition state, this event is ignored.
1485 */
1486 if ((qhp->attr.state >= C4IW_QP_STATE_ERROR) &&
1487 (attrs->next_state == C4IW_QP_STATE_TERMINATE)) {
1488 ret = -EINPROGRESS;
1489 goto out;
1490 }
1491
1476 switch (qhp->attr.state) {
1477 case C4IW_QP_STATE_IDLE:
1478 switch (attrs->next_state) {
1479 case C4IW_QP_STATE_RTS:
1480 if (!(mask & C4IW_QP_ATTR_LLP_STREAM_HANDLE)) {
1481 ret = -EINVAL;
1482 goto out;
1483 }

--- 371 unchanged lines hidden (view full) ---

1855 insert_mmap(ucontext, rq_db_key_mm);
1856
1857 c4iw_get_ucontext(ucontext);
1858 qhp->ucontext = ucontext;
1859 }
1860 qhp->ibqp.qp_num = qhp->wq.sq.qid;
1861 init_timer(&(qhp->timer));
1862
1492 switch (qhp->attr.state) {
1493 case C4IW_QP_STATE_IDLE:
1494 switch (attrs->next_state) {
1495 case C4IW_QP_STATE_RTS:
1496 if (!(mask & C4IW_QP_ATTR_LLP_STREAM_HANDLE)) {
1497 ret = -EINVAL;
1498 goto out;
1499 }

--- 371 unchanged lines hidden (view full) ---

1871 insert_mmap(ucontext, rq_db_key_mm);
1872
1873 c4iw_get_ucontext(ucontext);
1874 qhp->ucontext = ucontext;
1875 }
1876 qhp->ibqp.qp_num = qhp->wq.sq.qid;
1877 init_timer(&(qhp->timer));
1878
1863 CTR5(KTR_IW_CXGBE, "%s sq id %u size %u memsize %zu num_entries %u\n",
1879 CTR5(KTR_IW_CXGBE, "%s sq id %u size %u memsize %zu num_entries %u",
1864 __func__, qhp->wq.sq.qid,
1865 qhp->wq.sq.size, qhp->wq.sq.memsize, attrs->cap.max_send_wr);
1880 __func__, qhp->wq.sq.qid,
1881 qhp->wq.sq.size, qhp->wq.sq.memsize, attrs->cap.max_send_wr);
1866 CTR5(KTR_IW_CXGBE, "%s rq id %u size %u memsize %zu num_entries %u\n",
1882 CTR5(KTR_IW_CXGBE, "%s rq id %u size %u memsize %zu num_entries %u",
1867 __func__, qhp->wq.rq.qid,
1868 qhp->wq.rq.size, qhp->wq.rq.memsize, attrs->cap.max_recv_wr);
1869 return &qhp->ibqp;
1870err7:
1871 kfree(rq_db_key_mm);
1872err6:
1873 kfree(sq_db_key_mm);
1874err5:

--- 75 unchanged lines hidden ---
1883 __func__, qhp->wq.rq.qid,
1884 qhp->wq.rq.size, qhp->wq.rq.memsize, attrs->cap.max_recv_wr);
1885 return &qhp->ibqp;
1886err7:
1887 kfree(rq_db_key_mm);
1888err6:
1889 kfree(sq_db_key_mm);
1890err5:

--- 75 unchanged lines hidden ---