e98d33f124481fd3c637bf829e1478aeb74b1adf
[deb_dpdk.git] / debian / patches / dpdk-dev-ppc-enable-7-7-examples-ip_pipeline-fix-lcore-mapping-for-ppc64.patch
1 From: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
2 Date: Thu, 8 Sep 2016 22:18:10 +0530
3 Subject: [PATCH 7/7] examples/ip_pipeline: fix lcore mapping for ppc64
4
5 This patch fixes ip_pipeline panic in app_init_core_map while preparing cpu
6 core map in powerpc with SMT off. cpu_core_map_compute_linux currently prepares
7 core mapping based on file existence in sysfs ie.
8
9 /sys/devices/system/cpu/cpu<LCORE_NUM>/topology/physical_package_id
10   /sys/devices/system/cpu/cpu<LCORE_NUM>/topology/core_id
11
12 These files do not exist for lcores which are offline for any reason (as in
13 powerpc, while SMT is off). In this situation, this function should further
14 continue preparing map for other online lcores instead of returning with -1
15 for a first unavailable lcore.
16
17 Also, in SMT=off scenario for powerpc, lcore ids can not be always indexed from
18 0 upto 'number of cores present' (/sys/devices/system/cpu/present). For eg, for
19 an online lcore 32, core_id returned in sysfs is 112 where online lcores are
20 10 (as in one configuration), hence sysfs lcore id can not be checked with
21 indexing lcore number before positioning lcore map array.
22
23 Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
24 Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
25 Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
26
27 Origin: Upstream, commit:58d55fd279dc6f8f8d92fcab3362e24e19c9fbea
28 Author: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com>
29 Last-Update: 2016-09-21
30 ---
31  examples/ip_pipeline/cpu_core_map.c | 8 ++++++++
32  1 file changed, 8 insertions(+)
33
34 diff --git a/examples/ip_pipeline/cpu_core_map.c b/examples/ip_pipeline/cpu_core_map.c
35 index cb088b1..dd8f678 100644
36 --- a/examples/ip_pipeline/cpu_core_map.c
37 +++ b/examples/ip_pipeline/cpu_core_map.c
38 @@ -351,8 +351,10 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
39                         int lcore_socket_id =
40                                 cpu_core_map_get_socket_id_linux(lcore_id);
41  
42 +#if !defined(RTE_ARCH_PPC_64)
43                         if (lcore_socket_id < 0)
44                                 return -1;
45 +#endif
46  
47                         if (((uint32_t) lcore_socket_id) == socket_id)
48                                 n_detected++;
49 @@ -368,6 +370,7 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
50                                         cpu_core_map_get_socket_id_linux(
51                                         lcore_id);
52  
53 +#if !defined(RTE_ARCH_PPC_64)
54                                 if (lcore_socket_id < 0)
55                                         return -1;
56  
57 @@ -377,9 +380,14 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
58  
59                                 if (lcore_core_id < 0)
60                                         return -1;
61 +#endif
62  
63 +#if !defined(RTE_ARCH_PPC_64)
64                                 if (((uint32_t) lcore_socket_id == socket_id) &&
65                                         ((uint32_t) lcore_core_id == core_id)) {
66 +#else
67 +                               if (((uint32_t) lcore_socket_id == socket_id)) {
68 +#endif
69                                         uint32_t pos = cpu_core_map_pos(map,
70                                                 socket_id,
71                                                 core_id_contig,
72 -- 
73 1.9.1
74