Skip to content

Commit 1062c57

Browse files
committed
Add: MTL patches for DPDK
1 parent 8bd2e78 commit 1062c57

File tree

5 files changed

+154
-0
lines changed

5 files changed

+154
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
diff --git a/drivers/net/pcap/pcap_osdep_windows.c b/drivers/net/pcap/pcap_osdep_windows.c
2+
index 1d398dc7ed..0965c2f5c9 100644
3+
--- a/drivers/net/pcap/pcap_osdep_windows.c
4+
+++ b/drivers/net/pcap/pcap_osdep_windows.c
5+
@@ -53,7 +53,7 @@ osdep_iface_index_get(const char *device_name)
6+
7+
ret = GetAdapterIndex(adapter_name, &index);
8+
if (ret != NO_ERROR) {
9+
- PMD_LOG(ERR, "GetAdapterIndex(%S) = %lu\n", adapter_name, ret);
10+
+ PMD_LOG(ERR, "GetAdapterIndex(%S) = %lu", adapter_name, ret);
11+
return -1;
12+
}
13+
14+
@@ -75,20 +75,20 @@ osdep_iface_mac_get(const char *device_name, struct rte_ether_addr *mac)
15+
16+
sys_ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, NULL, &size);
17+
if (sys_ret != ERROR_BUFFER_OVERFLOW) {
18+
- PMD_LOG(ERR, "GetAdapterAddresses() = %lu, expected %lu\n",
19+
+ PMD_LOG(ERR, "GetAdapterAddresses() = %lu, expected %lu",
20+
sys_ret, ERROR_BUFFER_OVERFLOW);
21+
return -1;
22+
}
23+
24+
info = (IP_ADAPTER_ADDRESSES *)malloc(size);
25+
if (info == NULL) {
26+
- PMD_LOG(ERR, "Cannot allocate adapter address info\n");
27+
+ PMD_LOG(ERR, "Cannot allocate adapter address info");
28+
return -1;
29+
}
30+
31+
sys_ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, info, &size);
32+
if (sys_ret != ERROR_SUCCESS) {
33+
- PMD_LOG(ERR, "GetAdapterAddresses() = %lu\n", sys_ret);
34+
+ PMD_LOG(ERR, "GetAdapterAddresses() = %lu", sys_ret);
35+
free(info);
36+
return -1;
37+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/app/test/meson.build b/app/test/meson.build
2+
index efec42a6bf..001ce7ac38 100644
3+
--- a/app/test/meson.build
4+
+++ b/app/test/meson.build
5+
@@ -135,7 +135,7 @@ source_file_deps = {
6+
'test_mp_secondary.c': ['hash'],
7+
'test_net_ether.c': ['net'],
8+
'test_net_ip6.c': ['net'],
9+
- 'test_pcapng.c': ['ethdev', 'net', 'pcapng', 'bus_vdev'],
10+
+ # 'test_pcapng.c': ['ethdev', 'net', 'pcapng', 'bus_vdev'],
11+
'test_pdcp.c': ['eventdev', 'pdcp', 'net', 'timer', 'security'],
12+
'test_pdump.c': ['pdump'] + sample_packet_forward_deps,
13+
'test_per_lcore.c': [],
14+
@@ -215,7 +215,7 @@ source_file_deps = {
15+
16+
source_file_ext_deps = {
17+
'test_compressdev.c': ['zlib'],
18+
- 'test_pcapng.c': ['pcap'],
19+
+ # 'test_pcapng.c': ['pcap'],
20+
}
21+
22+
def_lib = get_option('default_library')
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
diff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h
2+
index e1c31017d1..0cdda68176 100644
3+
--- a/lib/eal/windows/include/pthread.h
4+
+++ b/lib/eal/windows/include/pthread.h
5+
@@ -42,6 +42,7 @@ typedef SYNCHRONIZATION_BARRIER pthread_barrier_t;
6+
!DeleteSynchronizationBarrier(barrier)
7+
#define pthread_cancel(thread) !TerminateThread((HANDLE) thread, 0)
8+
9+
+#ifndef __MINGW32__
10+
static inline int
11+
pthread_create(void *threadid, const void *threadattr, void *threadfunc,
12+
void *args)
13+
@@ -86,6 +87,45 @@ pthread_mutex_destroy(pthread_mutex_t *mutex)
14+
DeleteCriticalSection(mutex);
15+
return 0;
16+
}
17+
+#else
18+
+int pthread_create(void *threadid, const void *threadattr,
19+
+ void *threadfunc, void *args);
20+
+int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr);
21+
+int pthread_mutex_lock(pthread_mutex_t *mutex);
22+
+int pthread_mutex_unlock(pthread_mutex_t *mutex);
23+
+int pthread_mutex_destroy(pthread_mutex_t *mutex);
24+
+int pthread_join(pthread_t thread, void** res);
25+
+#endif
26+
+
27+
+static inline int
28+
+pthread_setaffinity_np(pthread_t threadid, size_t cpuset_size,
29+
+ rte_cpuset_t *cpuset)
30+
+{
31+
+ DWORD_PTR ret = 0;
32+
+ HANDLE thread_handle;
33+
+
34+
+ if (cpuset == NULL || cpuset_size == 0)
35+
+ return -1;
36+
+
37+
+ thread_handle = OpenThread(THREAD_ALL_ACCESS, FALSE, threadid);
38+
+ if (thread_handle == NULL) {
39+
+ RTE_LOG_WIN32_ERR("OpenThread()");
40+
+ return -1;
41+
+ }
42+
+
43+
+ ret = SetThreadAffinityMask(thread_handle, *cpuset->_bits);
44+
+ if (ret == 0) {
45+
+ RTE_LOG_WIN32_ERR("SetThreadAffinityMask()");
46+
+ goto close_handle;
47+
+ }
48+
+
49+
+close_handle:
50+
+ if (CloseHandle(thread_handle) == 0) {
51+
+ RTE_LOG_WIN32_ERR("CloseHandle()");
52+
+ return -1;
53+
+ }
54+
+ return (ret == 0) ? -1 : 0;
55+
+}
56+
57+
#ifdef __cplusplus
58+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/lib/eal/windows/getopt.c b/lib/eal/windows/getopt.c
2+
index 50ff71b930..da07fd44de 100644
3+
--- a/lib/eal/windows/getopt.c
4+
+++ b/lib/eal/windows/getopt.c
5+
@@ -458,6 +458,7 @@ getopt_long(int nargc, char *const nargv[], const char *options,
6+
* getopt_long_only --
7+
* Parse argc/argv argument vector.
8+
*/
9+
+#ifndef __MINGW32__
10+
int
11+
getopt_long_only(int nargc, char *const nargv[], const char *options,
12+
const struct option *long_options, int *idx)
13+
@@ -466,5 +467,6 @@ getopt_long_only(int nargc, char *const nargv[], const char *options,
14+
return (getopt_internal(nargc, nargv, options, long_options, idx,
15+
FLAG_PERMUTE|FLAG_LONGONLY));
16+
}
17+
+#endif
18+
19+
#endif /* NEED_USUAL_GETOPT */
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/drivers/net/intel/ice/ice_ethdev.h b/drivers/net/intel/ice/ice_ethdev.h
2+
index 72ed65f13b..460bc48559 100644
3+
--- a/drivers/net/intel/ice/ice_ethdev.h
4+
+++ b/drivers/net/intel/ice/ice_ethdev.h
5+
@@ -48,8 +48,13 @@
6+
#define ICE_MAX_PKT_TYPE 1024
7+
8+
/* DDP package search path */
9+
+#ifndef RTE_EXEC_ENV_WINDOWS
10+
#define ICE_PKG_FILE_DEFAULT "/lib/firmware/intel/ice/ddp/ice.pkg"
11+
#define ICE_PKG_FILE_UPDATES "/lib/firmware/updates/intel/ice/ddp/ice.pkg"
12+
+#else
13+
+#define ICE_PKG_FILE_DEFAULT "./ice.pkg"
14+
+#define ICE_PKG_FILE_UPDATES "c:\\dpdk\\lib\\ice.pkg"
15+
+#endif
16+
#define ICE_PKG_FILE_SEARCH_PATH_DEFAULT "/lib/firmware/intel/ice/ddp/"
17+
#define ICE_PKG_FILE_SEARCH_PATH_UPDATES "/lib/firmware/updates/intel/ice/ddp/"
18+
#define ICE_PKG_FILE_CUSTOMIZED_PATH "/sys/module/firmware_class/parameters/path"

0 commit comments

Comments
 (0)