Commit 47d680b6 authored by zhuyikai's avatar zhuyikai Committed by s00851154
Browse files

net/hinic3: Support new RX feature

driver inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IB6TTO?from=project-issue


CVE: NA

--------------------------------

Support new RX WQE type.

Signed-off-by: default avatarzhuyikai <zhuyikai1@h-partners.com>
parent 74e38462
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
#ifndef HINIC3_MT_H
#define HINIC3_MT_H

#define HINIC3_DRV_NAME "hisdk3"
#define HINIC3_DRV_NAME "hinic3"
#define HINIC3_CHIP_NAME "hinic"
/* Interrupt at most records, interrupt will be recorded in the FFM */

+1 −0
Original line number Diff line number Diff line
@@ -247,6 +247,7 @@ struct hinic3_nic_dev {
	struct hinic3_txq	*txqs;
	struct hinic3_rxq	*rxqs;
	struct hinic3_dyna_txrxq_params q_params;
	u8 cqe_mode; /* rx_cqe */

	u16			num_qp_irq;
	struct irq_info		*qps_irq_info;
+19 −4
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ MODULE_PARM_DESC(tx_coalescing_time, "TX CI coalescing parameter coalescing_time

static unsigned char rq_wqe_type = HINIC3_NORMAL_RQ_WQE;
module_param(rq_wqe_type, byte, 0444);
MODULE_PARM_DESC(rq_wqe_type, "RQ WQE type 0-8Bytes, 1-16Bytes, 2-32Bytes (default=2)");
MODULE_PARM_DESC(rq_wqe_type, "RQ WQE type 0-8Bytes, 1-16Bytes, 2-32Bytes (default=1)");

/*lint +e806*/
static u32 tx_drop_thd_on = HINIC3_DEAULT_DROP_THD_ON;
@@ -274,8 +274,15 @@ int hinic3_get_rq_wqe_type(void *hwdev)
	/* rq_wqe_type is the configuration when the driver is installed,
	 * but it may not be the actual configuration.
	 */
	if (HINIC3_SUPPORT_RX_COMPACT_CQE(hwdev)) {
		if (rq_wqe_type != HINIC3_COMPACT_RQ_WQE && rq_wqe_type != HINIC3_NORMAL_RQ_WQE &&
		    rq_wqe_type != HINIC3_EXTEND_RQ_WQE) {
			return HINIC3_NORMAL_RQ_WQE;
		}
	} else {
		if (rq_wqe_type != HINIC3_NORMAL_RQ_WQE && rq_wqe_type != HINIC3_EXTEND_RQ_WQE)
			return HINIC3_NORMAL_RQ_WQE;
	}
	return rq_wqe_type;
}

@@ -289,7 +296,7 @@ static int hinic3_create_rq(struct hinic3_nic_io *nic_io, struct hinic3_io_queue
	rq->msix_entry_idx = rq_msix_idx;

	err = hinic3_wq_create(nic_io->hwdev, &rq->wq, rq_depth,
			       (u16)BIT(HINIC3_RQ_WQEBB_SHIFT + rq_wqe_type));
			       (u16)BIT(HINIC3_RQ_WQEBB_SHIFT + rq->wqe_type));
	if (err) {
		sdk_err(nic_io->dev_hdl, "Failed to create rx queue(%u) wq\n",
			q_id);
@@ -774,6 +781,10 @@ void hinic3_rq_prepare_ctxt(struct hinic3_io_queue *rq, struct hinic3_rq_ctxt *r
			RQ_CTXT_WQ_PAGE_SET(2, WQE_TYPE);
		rq_ctxt->cqe_sge_len = RQ_CTXT_CQE_LEN_SET(1, CQE_LEN);
		break;
	case HINIC3_COMPACT_RQ_WQE:
		/* use 8Byte WQE */
		rq_ctxt->wq_pfn_hi_type_owner |= RQ_CTXT_WQ_PAGE_SET(3, WQE_TYPE);
		break;
	default:
		pr_err("Invalid rq wqe type: %u", wqe_type);
	}
@@ -985,6 +996,10 @@ static int init_rq_ci_ctxts(struct hinic3_nic_io *nic_io)
		rq_attr.intr_idx = nic_io->rq[q_id].msix_entry_idx;
		rq_attr.l2nic_rqn = q_id;
		rq_attr.cqe_type = 0;
		if (hinic3_get_rq_wqe_type(nic_io->hwdev) == HINIC3_COMPACT_RQ_WQE) {
			rq_attr.cqe_type = 1;
			rq_attr.ci_dma_base = HINIC3_CI_PADDR(nic_io->rq_ci_dma_base, q_id);
		}

		err = hinic3_set_rq_ci_ctx(nic_io, &rq_attr);
		if (err != 0) {
+2 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ struct hinic3_nic_db {
struct hinic3_tx_rx_ops {
	void (*tx_set_wqebb_cnt)(void *wqe_combo, u32 offload, u16 num_sge);
	void (*tx_set_wqe_task)(void *wqe_combo, void *offload_info);
	void (*rx_get_cqe_info)(void *rx_cqe, void *cqe_info);
	void (*rx_get_cqe_info)(void *rx_cqe, void *cqe_info, u8 cqe_mode);
	bool (*rx_cqe_done)(void *rxq, void **rx_cqe);
};

@@ -336,4 +336,5 @@ int hinic3_init_qps(void *hwdev, struct hinic3_dyna_qp_params *qp_params);
void hinic3_deinit_qps(void *hwdev, struct hinic3_dyna_qp_params *qp_params);
int hinic3_init_nicio_res(void *hwdev);
void hinic3_deinit_nicio_res(void *hwdev);
int hinic3_get_rq_wqe_type(void *hwdev);
#endif
+11 −2
Original line number Diff line number Diff line
@@ -194,6 +194,9 @@ struct hinic3_rq_cqe {
};

struct hinic3_cqe_info {
	u8 pkt_offset;
	u8 rsvd[3];

	u8 lro_num;
	u8 vlan_offload;
	u8 pkt_fmt;
@@ -230,8 +233,14 @@ struct hinic3_rq_normal_wqe {
	u32 cqe_lo_addr;
};

struct hinic3_rq_compact_wqe {
	u32 buf_hi_addr;
	u32 buf_lo_addr;
};

struct hinic3_rq_wqe {
	union {
		struct hinic3_rq_compact_wqe compact_wqe;
		struct hinic3_rq_normal_wqe normal_wqe;
		struct hinic3_rq_extend_wqe extend_wqe;
	};
@@ -286,8 +295,8 @@ struct hinic3_sq_wqe_combo {
	struct hinic3_sq_bufdesc *bds_sec2;

	u16 first_bds_num;
	u32 wqe_type;
	u32 task_type;
	u8 wqe_type;
	u8 task_type;

	u16 wqebb_cnt;
	u8 rsvd[2];
Loading