Deleted Added
full compact
t4.h (331769) t4.h (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:

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

23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 * SOFTWARE.
30 *
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:

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

23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
26 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
28 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 * SOFTWARE.
30 *
31 * $FreeBSD: stable/11/sys/dev/cxgbe/iw_cxgbe/t4.h 331769 2018-03-30 18:06:29Z hselasky $
31 * $FreeBSD: stable/11/sys/dev/cxgbe/iw_cxgbe/t4.h 346923 2019-04-29 20:10:28Z np $
32 */
33#ifndef __T4_H__
34#define __T4_H__
35
36#include "common/t4_regs_values.h"
37#include "common/t4_regs.h"
38/*
39 * Fixme: Adding missing defines

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

483
484static inline void
485t4_ring_sq_db(struct t4_wq *wq, u16 inc, union t4_wr *wqe, u8 wc)
486{
487
488 /* Flush host queue memory writes. */
489 wmb();
490 if (wc && inc == 1 && wq->sq.bar2_qid == 0 && wqe) {
32 */
33#ifndef __T4_H__
34#define __T4_H__
35
36#include "common/t4_regs_values.h"
37#include "common/t4_regs.h"
38/*
39 * Fixme: Adding missing defines

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

483
484static inline void
485t4_ring_sq_db(struct t4_wq *wq, u16 inc, union t4_wr *wqe, u8 wc)
486{
487
488 /* Flush host queue memory writes. */
489 wmb();
490 if (wc && inc == 1 && wq->sq.bar2_qid == 0 && wqe) {
491 CTR2(KTR_IW_CXGBE, "%s: WC wq->sq.pidx = %d\n",
491 CTR2(KTR_IW_CXGBE, "%s: WC wq->sq.pidx = %d",
492 __func__, wq->sq.pidx);
493 pio_copy((u64 __iomem *)
494 ((u64)wq->sq.bar2_va + SGE_UDB_WCDOORBELL),
495 (u64 *)wqe);
496 } else {
492 __func__, wq->sq.pidx);
493 pio_copy((u64 __iomem *)
494 ((u64)wq->sq.bar2_va + SGE_UDB_WCDOORBELL),
495 (u64 *)wqe);
496 } else {
497 CTR2(KTR_IW_CXGBE, "%s: DB wq->sq.pidx = %d\n",
497 CTR2(KTR_IW_CXGBE, "%s: DB wq->sq.pidx = %d",
498 __func__, wq->sq.pidx);
499 writel(V_PIDX_T5(inc) | V_QID(wq->sq.bar2_qid),
500 (void __iomem *)((u64)wq->sq.bar2_va +
501 SGE_UDB_KDOORBELL));
502 }
503
504 /* Flush user doorbell area writes. */
505 wmb();
506 return;
507}
508
509static inline void
510t4_ring_rq_db(struct t4_wq *wq, u16 inc, union t4_recv_wr *wqe, u8 wc)
511{
512
513 /* Flush host queue memory writes. */
514 wmb();
515 if (wc && inc == 1 && wq->rq.bar2_qid == 0 && wqe) {
498 __func__, wq->sq.pidx);
499 writel(V_PIDX_T5(inc) | V_QID(wq->sq.bar2_qid),
500 (void __iomem *)((u64)wq->sq.bar2_va +
501 SGE_UDB_KDOORBELL));
502 }
503
504 /* Flush user doorbell area writes. */
505 wmb();
506 return;
507}
508
509static inline void
510t4_ring_rq_db(struct t4_wq *wq, u16 inc, union t4_recv_wr *wqe, u8 wc)
511{
512
513 /* Flush host queue memory writes. */
514 wmb();
515 if (wc && inc == 1 && wq->rq.bar2_qid == 0 && wqe) {
516 CTR2(KTR_IW_CXGBE, "%s: WC wq->rq.pidx = %d\n",
516 CTR2(KTR_IW_CXGBE, "%s: WC wq->rq.pidx = %d",
517 __func__, wq->rq.pidx);
518 pio_copy((u64 __iomem *)((u64)wq->rq.bar2_va +
519 SGE_UDB_WCDOORBELL), (u64 *)wqe);
520 } else {
517 __func__, wq->rq.pidx);
518 pio_copy((u64 __iomem *)((u64)wq->rq.bar2_va +
519 SGE_UDB_WCDOORBELL), (u64 *)wqe);
520 } else {
521 CTR2(KTR_IW_CXGBE, "%s: DB wq->rq.pidx = %d\n",
521 CTR2(KTR_IW_CXGBE, "%s: DB wq->rq.pidx = %d",
522 __func__, wq->rq.pidx);
523 writel(V_PIDX_T5(inc) | V_QID(wq->rq.bar2_qid),
524 (void __iomem *)((u64)wq->rq.bar2_va +
525 SGE_UDB_KDOORBELL));
526 }
527
528 /* Flush user doorbell area writes. */
529 wmb();

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

597 cq->cidx_inc = 0;
598 return 0;
599}
600
601static inline void t4_swcq_produce(struct t4_cq *cq)
602{
603 cq->sw_in_use++;
604 if (cq->sw_in_use == cq->size) {
522 __func__, wq->rq.pidx);
523 writel(V_PIDX_T5(inc) | V_QID(wq->rq.bar2_qid),
524 (void __iomem *)((u64)wq->rq.bar2_va +
525 SGE_UDB_KDOORBELL));
526 }
527
528 /* Flush user doorbell area writes. */
529 wmb();

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

597 cq->cidx_inc = 0;
598 return 0;
599}
600
601static inline void t4_swcq_produce(struct t4_cq *cq)
602{
603 cq->sw_in_use++;
604 if (cq->sw_in_use == cq->size) {
605 CTR2(KTR_IW_CXGBE, "%s cxgb4 sw cq overflow cqid %u\n",
605 CTR2(KTR_IW_CXGBE, "%s cxgb4 sw cq overflow cqid %u",
606 __func__, cq->cqid);
607 cq->error = 1;
608 BUG_ON(1);
609 }
610 if (++cq->sw_pidx == cq->size)
611 cq->sw_pidx = 0;
612}
613

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

669 } else
670 ret = -ENODATA;
671 return ret;
672}
673
674static inline struct t4_cqe *t4_next_sw_cqe(struct t4_cq *cq)
675{
676 if (cq->sw_in_use == cq->size) {
606 __func__, cq->cqid);
607 cq->error = 1;
608 BUG_ON(1);
609 }
610 if (++cq->sw_pidx == cq->size)
611 cq->sw_pidx = 0;
612}
613

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

669 } else
670 ret = -ENODATA;
671 return ret;
672}
673
674static inline struct t4_cqe *t4_next_sw_cqe(struct t4_cq *cq)
675{
676 if (cq->sw_in_use == cq->size) {
677 CTR2(KTR_IW_CXGBE, "%s cxgb4 sw cq overflow cqid %u\n",
677 CTR2(KTR_IW_CXGBE, "%s cxgb4 sw cq overflow cqid %u",
678 __func__, cq->cqid);
679 cq->error = 1;
680 BUG_ON(1);
681 return NULL;
682 }
683 if (cq->sw_in_use)
684 return &cq->sw_queue[cq->sw_cidx];
685 return NULL;

--- 35 unchanged lines hidden ---
678 __func__, cq->cqid);
679 cq->error = 1;
680 BUG_ON(1);
681 return NULL;
682 }
683 if (cq->sw_in_use)
684 return &cq->sw_queue[cq->sw_cidx];
685 return NULL;

--- 35 unchanged lines hidden ---