Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
52b02d5667
!25 libvma升级至9.8.1版本
From: @wu-leilei 
Reviewed-by: @caodongxia, @bitcoffee 
Signed-off-by: @bitcoffee
2023-08-09 09:40:53 +00:00
wu-leilei
d55e2df086 Update to 9.8.1 2023-08-09 17:01:31 +08:00
openeuler-ci-bot
6a21b581bc
!22 [sync] PR-20: add loongarch64 support for libvma
From: @openeuler-sync-bot 
Reviewed-by: @LemmyHuang 
Signed-off-by: @LemmyHuang
2023-03-14 03:51:34 +00:00
Wenlong Zhang
3178d19bd1 add loongarch64 support for libvma
(cherry picked from commit 383b52c896510366ecd4e514222991f289a7a90c)
2023-03-14 11:42:03 +08:00
openeuler-ci-bot
29b2fcac1d !17 fix build error with glibc-2.34
From: @wang_yue111
Reviewed-by: @hubble_zhu,@hubble_zhu,@hubble_zhu
Signed-off-by: @hubble_zhu
2021-08-10 11:24:51 +00:00
wang_yue111
e1d9972fcc fix build error with glibc-2.34 2021-08-10 10:36:49 +08:00
openeuler-ci-bot
b5ddbf5386 !16 修复因缺少依赖导致编译失败问题
From: @wu-leilei
Reviewed-by: @hubble_zhu
Signed-off-by: @hubble_zhu
2021-06-15 08:32:43 +00:00
wu-leilei
7c7ed16adf fixes failed: g++: No such file or directory 2021-06-08 15:36:30 +08:00
openeuler-ci-bot
cd2e5e8092 !8 [sync] PR-7: Remove ExecReload that is not supported
From: @openeuler-sync-bot
Reviewed-by: @small_leek,@hubble_zhu
Signed-off-by: @small_leek,@hubble_zhu
2021-03-10 11:30:04 +08:00
maminjie
f31c217971 Remove ExecReload that is not supported
(cherry picked from commit d5b35cff09d72e271ad0e309735335bad9daf317)
2021-03-10 10:52:32 +08:00
5 changed files with 184 additions and 230 deletions

Binary file not shown.

BIN
9.8.1.tar.gz Normal file

Binary file not shown.

View File

@ -1,216 +0,0 @@
From 1858b6fc989db967376a5a0c761623582b99080b Mon Sep 17 00:00:00 2001
From: Igor Ivanov <igor.ivanov.va@gmail.com>
Date: Fri, 11 Oct 2019 17:15:01 +0300
Subject: [PATCH] issue: 1909532 Resolve gcc 9.x issues
gcc 9.x enables [-Werror=address-of-packed-member] verification.
So it produced taking address of packed member of <struct name>
may result in an unaligned pointer value.
Signed-off-by: Igor Ivanov <igor.ivanov.va@gmail.com>
---
src/vma/dev/cq_mgr.inl | 8 ++++----
src/vma/dev/rfs.h | 22 +++++++++++-----------
src/vma/dev/ring_slave.cpp | 10 +++++-----
src/vma/ib/base/verbs_extra.cpp | 4 ++--
src/vma/proto/header.h | 4 ++--
src/vma/proto/igmp_handler.h | 2 +-
6 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/src/vma/dev/cq_mgr.inl b/src/vma/dev/cq_mgr.inl
index 8739ff686..7b5564e89 100644
--- a/src/vma/dev/cq_mgr.inl
+++ b/src/vma/dev/cq_mgr.inl
@@ -72,17 +72,17 @@ inline uint32_t cq_mgr::process_recv_queue(void* pv_fd_ready_array)
inline bool is_eth_tcp_frame(mem_buf_desc_t* buff)
{
struct ethhdr* p_eth_h = (struct ethhdr*)(buff->p_buffer);
- uint16_t* p_h_proto = &p_eth_h->h_proto;
+ uint16_t h_proto = p_eth_h->h_proto;
size_t transport_header_len = ETH_HDR_LEN;
struct vlanhdr* p_vlan_hdr = NULL;
- if (*p_h_proto == htons(ETH_P_8021Q)) {
+ if (h_proto == htons(ETH_P_8021Q)) {
p_vlan_hdr = (struct vlanhdr*)((uint8_t*)p_eth_h + transport_header_len);
transport_header_len = ETH_VLAN_HDR_LEN;
- p_h_proto = &p_vlan_hdr->h_vlan_encapsulated_proto;
+ h_proto = p_vlan_hdr->h_vlan_encapsulated_proto;
}
struct iphdr *p_ip_h = (struct iphdr*)(buff->p_buffer + transport_header_len);
- if (likely(*p_h_proto == htons(ETH_P_IP)) && (p_ip_h->protocol == IPPROTO_TCP)) {
+ if (likely(h_proto == htons(ETH_P_IP)) && (p_ip_h->protocol == IPPROTO_TCP)) {
return true;
}
return false;
diff --git a/src/vma/dev/rfs.h b/src/vma/dev/rfs.h
index 30edec455..bd0a84c33 100644
--- a/src/vma/dev/rfs.h
+++ b/src/vma/dev/rfs.h
@@ -58,10 +58,10 @@ class pkt_rcvr_sink;
/* ETHERNET
*/
-typedef struct __attribute__ ((packed)) attach_flow_data_eth_ipv4_tcp_udp_t {
+typedef struct attach_flow_data_eth_ipv4_tcp_udp_t {
struct ibv_flow * ibv_flow;
qp_mgr* p_qp_mgr;
- struct __attribute__ ((packed)) ibv_flow_attr_eth_ipv4_tcp_udp {
+ struct ibv_flow_attr_eth_ipv4_tcp_udp {
vma_ibv_flow_attr attr;
vma_ibv_flow_spec_eth eth;
vma_ibv_flow_spec_ipv4 ipv4;
@@ -89,10 +89,10 @@ typedef struct __attribute__ ((packed)) attach_flow_data_eth_ipv4_tcp_udp_t {
/* IPOIB (MC)
*/
-typedef struct __attribute__ ((packed)) attach_flow_data_ib_v2_t {
+typedef struct attach_flow_data_ib_v2_t {
struct ibv_flow * ibv_flow;
qp_mgr* p_qp_mgr;
- struct __attribute__ ((packed)) ibv_flow_attr_ib_v2 {
+ struct ibv_flow_attr_ib_v2 {
vma_ibv_flow_attr attr;
vma_ibv_flow_spec_ipv4 ipv4;
vma_ibv_flow_spec_tcp_udp tcp_udp;
@@ -114,10 +114,10 @@ typedef struct __attribute__ ((packed)) attach_flow_data_ib_v2_t {
} attach_flow_data_ib_v2_t;
#ifdef DEFINED_IBV_FLOW_SPEC_IB
-typedef struct __attribute__ ((packed)) attach_flow_data_ib_v1_t {
+typedef struct attach_flow_data_ib_v1_t {
struct ibv_flow * ibv_flow;
qp_mgr* p_qp_mgr;
- struct __attribute__ ((packed)) ibv_flow_attr_ib_v1 {
+ struct ibv_flow_attr_ib_v1 {
vma_ibv_flow_attr attr;
vma_ibv_flow_spec_ib ib;
@@ -140,10 +140,10 @@ typedef struct __attribute__ ((packed)) attach_flow_data_ib_v1_t {
/* IPOIB (UC)
*/
-typedef struct __attribute__ ((packed)) attach_flow_data_ib_ipv4_tcp_udp_v2_t {
+typedef struct attach_flow_data_ib_ipv4_tcp_udp_v2_t {
struct ibv_flow * ibv_flow;
qp_mgr* p_qp_mgr;
- struct __attribute__ ((packed)) ibv_flow_attr_ib_ipv4_tcp_udp_v2 {
+ struct ibv_flow_attr_ib_ipv4_tcp_udp_v2 {
vma_ibv_flow_attr attr;
vma_ibv_flow_spec_ipv4 ipv4;
@@ -165,10 +165,10 @@ typedef struct __attribute__ ((packed)) attach_flow_data_ib_ipv4_tcp_udp_v2_t {
} attach_flow_data_ib_ipv4_tcp_udp_v2_t;
#ifdef DEFINED_IBV_FLOW_SPEC_IB
-typedef struct __attribute__ ((packed)) attach_flow_data_ib_ipv4_tcp_udp_v1_t {
+typedef struct attach_flow_data_ib_ipv4_tcp_udp_v1_t {
struct ibv_flow * ibv_flow;
qp_mgr* p_qp_mgr;
- struct __attribute__ ((packed)) ibv_flow_attr_ib_ipv4_tcp_udp_v1 {
+ struct ibv_flow_attr_ib_ipv4_tcp_udp_v1 {
vma_ibv_flow_attr attr;
vma_ibv_flow_spec_ib ib;
@@ -191,7 +191,7 @@ typedef struct __attribute__ ((packed)) attach_flow_data_ib_ipv4_tcp_udp_v1_t {
} attach_flow_data_ib_ipv4_tcp_udp_v1_t;
#endif /* DEFINED_IBV_FLOW_SPEC_IB */
-typedef struct __attribute__ ((packed)) attach_flow_data_t {
+typedef struct attach_flow_data_t {
vma_ibv_flow * ibv_flow;
qp_mgr* p_qp_mgr;
vma_ibv_flow_attr ibv_flow_attr;
diff --git a/src/vma/dev/ring_slave.cpp b/src/vma/dev/ring_slave.cpp
index 7d7f0375b..c691eafb1 100644
--- a/src/vma/dev/ring_slave.cpp
+++ b/src/vma/dev/ring_slave.cpp
@@ -630,20 +630,20 @@ bool ring_slave::rx_process_buffer(mem_buf_desc_t* p_rx_wc_buf_desc, void* pv_fd
// printf("\n");
// }
- uint16_t* p_h_proto = &p_eth_h->h_proto;
+ uint16_t h_proto = p_eth_h->h_proto;
ring_logfunc("Rx buffer Ethernet dst=" ETH_HW_ADDR_PRINT_FMT " <- src=" ETH_HW_ADDR_PRINT_FMT " type=%#x",
ETH_HW_ADDR_PRINT_ADDR(p_eth_h->h_dest),
ETH_HW_ADDR_PRINT_ADDR(p_eth_h->h_source),
- htons(*p_h_proto));
+ htons(h_proto));
// Handle VLAN header as next protocol
struct vlanhdr* p_vlan_hdr = NULL;
uint16_t packet_vlan = 0;
- if (*p_h_proto == htons(ETH_P_8021Q)) {
+ if (h_proto == htons(ETH_P_8021Q)) {
p_vlan_hdr = (struct vlanhdr*)((uint8_t*)p_eth_h + ETH_HDR_LEN);
transport_header_len = ETH_VLAN_HDR_LEN;
- p_h_proto = &p_vlan_hdr->h_vlan_encapsulated_proto;
+ h_proto = p_vlan_hdr->h_vlan_encapsulated_proto;
packet_vlan = (htons(p_vlan_hdr->h_vlan_TCI) & VLAN_VID_MASK);
} else {
transport_header_len = ETH_HDR_LEN;
@@ -656,7 +656,7 @@ bool ring_slave::rx_process_buffer(mem_buf_desc_t* p_rx_wc_buf_desc, void* pv_fd
}
// Validate IP header as next protocol
- if (unlikely(*p_h_proto != htons(ETH_P_IP))) {
+ if (unlikely(h_proto != htons(ETH_P_IP))) {
ring_logwarn("Rx buffer dropped - Invalid Ethr Type (%#x : %#x)", p_eth_h->h_proto, htons(ETH_P_IP));
return false;
}
diff --git a/src/vma/ib/base/verbs_extra.cpp b/src/vma/ib/base/verbs_extra.cpp
index 8b7a062ca..5f9b34c90 100644
--- a/src/vma/ib/base/verbs_extra.cpp
+++ b/src/vma/ib/base/verbs_extra.cpp
@@ -299,7 +299,7 @@ int priv_ibv_query_flow_tag_supported(struct ibv_qp *qp, uint8_t port_num)
#ifdef DEFINED_IBV_FLOW_TAG
// Create
- struct __attribute__ ((packed)) {
+ struct {
vma_ibv_flow_attr attr;
vma_ibv_flow_spec_eth eth;
vma_ibv_flow_spec_ipv4 ipv4;
@@ -342,7 +342,7 @@ int priv_ibv_create_flow_supported(struct ibv_qp *qp, uint8_t port_num)
{
int res = -1;
- struct __attribute__ ((packed)) {
+ struct {
vma_ibv_flow_attr attr;
vma_ibv_flow_spec_ipv4 ipv4;
vma_ibv_flow_spec_tcp_udp tcp_udp;
diff --git a/src/vma/proto/header.h b/src/vma/proto/header.h
index 9562ba920..e3cbb2162 100644
--- a/src/vma/proto/header.h
+++ b/src/vma/proto/header.h
@@ -75,13 +75,13 @@ struct __attribute__ ((packed)) vlan_eth_hdr_template_t { // Offeset Size
// iphdr m_ip_hdr; // 20 20 = 40
};
-union __attribute__ ((packed)) l2_hdr_template_t {
+union l2_hdr_template_t {
ib_hdr_template_t ib_hdr;
eth_hdr_template_t eth_hdr;
vlan_eth_hdr_template_t vlan_eth_hdr;
};
-struct __attribute__ ((packed)) tx_hdr_template_t { // Offeset Size
+struct __attribute__ ((packed, aligned)) tx_hdr_template_t { // Offeset Size
l2_hdr_template_t m_l2_hdr; // 0 20
iphdr m_ip_hdr; // 20 20
union {
diff --git a/src/vma/proto/igmp_handler.h b/src/vma/proto/igmp_handler.h
index fbae0b58b..1dc24c622 100644
--- a/src/vma/proto/igmp_handler.h
+++ b/src/vma/proto/igmp_handler.h
@@ -44,7 +44,7 @@
#define IGMP_TIMER_ID 0
-struct __attribute__ ((packed)) ip_igmp_tx_hdr_template_t {
+struct __attribute__ ((packed, aligned)) ip_igmp_tx_hdr_template_t {
iphdr m_ip_hdr;
uint32_t m_ip_hdr_ext;
igmphdr m_igmp_hdr;

View File

@ -0,0 +1,142 @@
From ee85f408afadcdbcaf4b5bafb649a7e9da7540f7 Mon Sep 17 00:00:00 2001
From: Wenlong Zhang <zhangwenlong@loongson.cn>
Date: Wed, 22 Feb 2023 17:00:50 +0800
Subject: [PATCH] add loongarch64 support for libvma
---
src/utils/Makefile.am | 1 +
src/utils/asm-loongarch64.h | 96 +++++++++++++++++++++++++++++++++++++
src/utils/asm.h | 2 +
3 files changed, 99 insertions(+)
create mode 100644 src/utils/asm-loongarch64.h
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 5808729..ae4a33a 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -5,6 +5,7 @@ libutils_la_LDFLAGS = -static
libutils_la_LIBADD = -lrt
libutils_la_SOURCES = \
asm-arm64.h \
+ asm-loongarch64.h \
asm-ppc64.h \
asm-x86.h \
asm.h \
diff --git a/src/utils/asm-loongarch64.h b/src/utils/asm-loongarch64.h
new file mode 100644
index 0000000..55ee563
--- /dev/null
+++ b/src/utils/asm-loongarch64.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+
+#ifndef ASMLOONGARCH64_H_
+#define ASMLOONGARCH64_H_
+
+#include <stdint.h>
+#include <unistd.h>
+
+#define COPY_64B_NT(dst, src) \
+ *dst++ = *src++; \
+ *dst++ = *src++; \
+ *dst++ = *src++; \
+ *dst++ = *src++; \
+ *dst++ = *src++; \
+ *dst++ = *src++; \
+ *dst++ = *src++; \
+ *dst++ = *src++
+
+#define mb() asm volatile("dbar 0" ::: "memory")
+#define rmb() mb()
+#define wmb() mb()
+#define wc_wmb() wmb()
+
+/**
+ * Add to the atomic variable.
+ * @param i integer value to add.
+ * @param v pointer of type atomic_t.
+ * @return Value before add.
+ */
+static inline int atomic_fetch_and_add(int i, volatile int *ptr)
+{
+ return __atomic_fetch_add(ptr, i, __ATOMIC_ACQUIRE);
+}
+
+/**
+ * Read RDTSC register
+ */
+static inline void gettimeoftsc(unsigned long long *p_tscval)
+{
+ // Read Time Stamp Counter
+ int rID=0;
+ asm volatile("ibar 0" : : : "memory");
+ asm volatile("rdtime.d %0, %1" : "=r" ((unsigned long long)*p_tscval),"=r" (rID));
+}
+
+/**
+ * Cache Line Prefetch - Arch specific!
+ */
+#ifndef L1_CACHE_BYTES
+#define L1_CACHE_BYTES 64
+#endif
+
+static inline void prefetch(void *x)
+{
+ __builtin_prefetch(x, 0, 1);
+}
+
+static inline void prefetch_range(void *addr, size_t len)
+{
+ char *cp = (char*)addr;
+ char *end = (char*)addr + len;
+ for (; cp < end; cp += L1_CACHE_BYTES)
+ prefetch(cp);
+}
+#endif
diff --git a/src/utils/asm.h b/src/utils/asm.h
index 78530cc..3afce8d 100644
--- a/src/utils/asm.h
+++ b/src/utils/asm.h
@@ -36,6 +36,8 @@
#if defined(__aarch64__)
#include "asm-arm64.h"
+#elif defined(__loongarch64)
+#include "asm-loongarch64.h"
#elif defined(__powerpc64__)
#include "asm-ppc64.h"
#elif defined(__x86_64__)
--
2.33.0

View File

@ -1,16 +1,17 @@
Name: libvma
Version: 8.9.4
Release: 9
Version: 9.8.1
Release: 1
Summary: A library that boosts performance for message-based and streaming applications
License: GPLv2 or BSD
URL: https://github.com/Mellanox/libvma
Source: https://github.com/Mellanox/libvma/archive/%{version}.tar.gz
Patch0000: Resolve-gcc-9.x-issues.patch
Patch0000: add-loongarch64-support-for-libvma.patch
ExcludeArch: %{arm}
Requires: pam
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
BuildRequires: rdma-core-devel libnl3-devel automake autoconf libtool
BuildRequires: rdma-core-devel libnl3-devel automake autoconf libtool g++
Provides: %{name}-utils = %{version}-%{release}
Obsoletes: %{name}-utils < %{version}-%{release}
@ -39,23 +40,34 @@ Headers files for libvma.
%make_build V=1
%install
%make_install
%delete_la
%{make_install}
%ldconfig_scriptlets
find $RPM_BUILD_ROOT%{_libdir} -name '*.la' -delete
install -D -m 644 contrib/scripts/vma.service $RPM_BUILD_ROOT/%{_prefix}/lib/systemd/system/vma.service
rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/vma
%post
%systemd_post vma.service
%preun
%systemd_preun vma.service
%postun
%systemd_postun_with_restart vma.service
%files
%defattr(-,root,root)
%doc README.md README.txt journal.txt VMA_VERSION.in
%license COPYING LICENSE
%doc README.md
%license LICENSE
%config(noreplace) %{_sysconfdir}/libvma.conf
%config(noreplace) %{_sysconfdir}/security/limits.d/30-libvma-limits.conf
%{_bindir}/vma_stats
%{_libdir}/%{name}.so
%{_libdir}/%{name}*.so.*
%{_sbindir}/vmad
%{_sbindir}/vma
%{_unitdir}/vma.service
%{_mandir}/man7/vma.*
%{_mandir}/man8/vmad.*
%{_mandir}/man8/vma_stats.*
%files devel
%defattr(-,root,root)
@ -63,11 +75,27 @@ Headers files for libvma.
%files help
%defattr(-,root,root)
%{_pkgdocdir}/README.txt
%{_pkgdocdir}/journal.txt
%{_pkgdocdir}/VMA_VERSION
%{_pkgdocdir}/README.md
%{_pkgdocdir}/README
%{_pkgdocdir}/CHANGES
%changelog
* Sat Jul 15 2023 wulei <wu_lei@hoperun.com> - 9.8.1-1
- Update to 9.8.1
* Mon Feb 6 2023 Wenlong Zhang <zhangwenlong@loongson.cn> - 8.9.4-13
- add loongarch64 support for libvma
* Tue Aug 10 2021 wangyue <wangyue92@huawei.com> - 8.9.4-12
- fix build error with glibc-2.34
* Tue Jun 08 2021 wulei <wulei80@huawei.com> - 8.9.4-11
- fixes failed: g++: No such file or directory
* Wed Mar 10 2021 maminjie <maminjie1@huawei.com> - 8.9.4-10
- Remove ExecReload that is not supported
* Thu Sep 3 2020 zhaowei<zhaowei23@huawei.com> - 8.9.4-9
-update source URL