Commit fd9560ca authored by Jie Lei's avatar Jie Lei Committed by JangShui Yang
Browse files

hns3 udma: support user-mode TP connection API

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8V1IQ


CVE: NA

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

This patch supports the user-mode TP connection
function in RC mode.
1.In the Jetty creation phase, the TP is created based
  on the sub_trans_mode of user.
2.The urma_get_tpn API is supported.
3.The urma_modify_tp API is supported.

Fixes: 4888db6e ("hns3 udma: support create and destroy JETTY")
Signed-off-by: default avatarChunZhi Hu <huchunzhi@huawei.com>
Signed-off-by: default avatarWeibo Zhao <zhaoweibo3@huawei.com>
Signed-off-by: default avatarJie Lei <leijie31@huawei.com>
parent 715feb71
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -25,6 +25,17 @@
#define DMA_WQE_SHIFT		3
#define DMA_DB_RECORD_SHIFT	1

/* The minimum page size is 4K for hardware */
#define UDMA_HW_PAGE_SHIFT			12
#define UDMA_PAGE_SIZE				(1 << UDMA_HW_PAGE_SHIFT)
#define UDMA_HW_PAGE_ALIGN(x)		ALIGN(x, 1 << UDMA_HW_PAGE_SHIFT)

static inline uint64_t umem_cal_npages(uint64_t va, uint64_t len)
{
	return (ALIGN(va + len, UDMA_PAGE_SIZE) - ALIGN_DOWN(va, UDMA_PAGE_SIZE)) /
	       UDMA_PAGE_SIZE;
}

#define udma_get_field(origin, mask, shift)                                    \
	((le32_to_cpu(origin) & (mask)) >> (uint32_t)(shift))
#define udma_get_field64(origin, mask, shift)                                  \
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@

#include <linux/slab.h>
#include "urma/ubcore_api.h"
#include "hns3_udma_common.h"
#include "hns3_udma_cmd.h"
#include "hns3_udma_debugfs.h"
#include "hns3_udma_dca.h"
+0 −6
Original line number Diff line number Diff line
@@ -116,12 +116,6 @@ struct dca_mem_enum_attr {
	udma_dca_enum_callback enum_fn;
};

static inline uint64_t umem_cal_npages(uint64_t va, uint64_t len)
{
	return (ALIGN(va + len, UDMA_PAGE_SIZE) - ALIGN_DOWN(va, UDMA_PAGE_SIZE)) /
	       UDMA_PAGE_SIZE;
}

static inline bool dca_page_is_attached(struct dca_page_state *state,
					uint32_t buf_id)
{
+0 −5
Original line number Diff line number Diff line
@@ -58,11 +58,6 @@
#define UDMA_SGE_SIZE				16
#define UDMA_IDX_QUE_ENTRY_SZ			4

/* The minimum page size is 4K for hardware */
#define UDMA_HW_PAGE_SHIFT			12
#define UDMA_PAGE_SIZE				(1 << UDMA_HW_PAGE_SHIFT)
#define UDMA_HW_PAGE_ALIGN(x)		ALIGN(x, 1 << UDMA_HW_PAGE_SHIFT)

#define UDMA_DWQE_SIZE				65536
#define UDMA_DWQE_MMAP_QP_NUM			1024

+7 −0
Original line number Diff line number Diff line
@@ -70,4 +70,11 @@ static inline enum udma_sgid_type get_sgid_type_from_eid(union ubcore_eid eid)
	return SGID_TYPE_IPV6;
}

static inline void udma_ipv4_map_to_eid(uint32_t ipv4, union ubcore_eid *eid)
{
	eid->in4.reserved = 0;
	eid->in4.prefix = cpu_to_be32(UDMA_IPV4_MAP_IPV6_PREFIX);
	eid->in4.addr = ipv4;
}

#endif /* _UDMA_EID_H */
Loading