-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinclude.mk
executable file
·150 lines (138 loc) · 5.21 KB
/
include.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
ifndef DRIVER_MODE
export DRIVER_MODE=PERFORMANCE
endif
export KDIR='pwd'/linux-4.4
export XDMA_PATH=$(ROOTDIR)/xdma
export XRAWDATA0_PATH=$(ROOTDIR)/xrawdata0
export XRAWDATA1_PATH=$(ROOTDIR)/xrawdata1
export XRAWDATA2_PATH=$(ROOTDIR)/xrawdata2
export XRAWDATA3_PATH=$(ROOTDIR)/xrawdata3
export XETHERNET0_PATH=$(ROOTDIR)/xxgbeth0
export XETHERNET1_PATH=$(ROOTDIR)/xxgbeth1
export XETHERNET2_PATH=$(ROOTDIR)/xxgbeth2
export XETHERNET3_PATH=$(ROOTDIR)/xxgbeth3
export INSMOD=/sbin/insmod
export RMMOD=/sbin/rmmod
export RM=/bin/rm
export MKNOD_CMD=/bin/mknod
export DMA_STATS_FILE=xdma_stat
export RAW0_FILE_NAME=xraw_data0
export RAW1_FILE_NAME=xraw_data1
export RAW2_FILE_NAME=xraw_data2
export RAW3_FILE_NAME=xraw_data3
export DMA_DRIVER_NAME=xdma_v7.ko
export RAW0_DRIVER_NAME=xrawdata0.ko
export RAW1_DRIVER_NAME=xrawdata1.ko
export RAW2_DRIVER_NAME=xrawdata2.ko
export RAW3_DRIVER_NAME=xrawdata3.ko
export XETHERNET0_DRIVER_NAME=xxgbeth0.ko
export XETHERNET1_DRIVER_NAME=xxgbeth1.ko
export XETHERNET2_DRIVER_NAME=xxgbeth2.ko
export XETHERNET3_DRIVER_NAME=xxgbeth3.ko
export SLEEP_TIME=1
MKNOD = `awk '/$(DMA_STATS_FILE)/ {print $$1}' /proc/devices`
MKNOD0 =`awk '/$(RAW0_FILE_NAME)/ {print $$1}' /proc/devices`
MKNOD1 =`awk '/$(RAW1_FILE_NAME)/ {print $$1}' /proc/devices`
MKNOD2 =`awk '/$(RAW2_FILE_NAME)/ {print $$1}' /proc/devices`
MKNOD3 =`awk '/$(RAW3_FILE_NAME)/ {print $$1}' /proc/devices`
define compile_performance_driver
echo Compiling Performance Driver
$(MAKE) -C $(XDMA_PATH)
$(MAKE) -C $(XRAWDATA0_PATH)
# $(MAKE) -C $(XRAWDATA1_PATH)
endef
define compile_rawethernet_driver
echo Compiling RawEthernet Driver
$(MAKE) -C $(XDMA_PATH)
$(MAKE) -C $(XRAWDATA0_PATH)
$(MAKE) -C $(XRAWDATA1_PATH)
$(MAKE) -C $(XRAWDATA2_PATH)
$(MAKE) -C $(XRAWDATA3_PATH)
endef
define compile_ethernet_driver
echo Compiling Ethernet Driver
$(MAKE) -C $(XDMA_PATH)
$(MAKE) -C $(XETHERNET0_PATH)
#$(MAKE) -C $(XETHERNET1_PATH)
#$(MAKE) -C $(XETHERNET2_PATH)
#$(MAKE) -C $(XETHERNET3_PATH)
endef
define clean_performance_driver
echo Cleaning Performance Driver
$(MAKE) -C $(XDMA_PATH) clean
$(MAKE) -C $(XRAWDATA0_PATH) clean
# $(MAKE) -C $(XRAWDATA1_PATH) clean
endef
define clean_rawethernet_driver
echo Cleaning RawEthernet Driver
$(MAKE) -C $(XDMA_PATH) clean
$(MAKE) -C $(XRAWDATA0_PATH) clean
$(MAKE) -C $(XRAWDATA1_PATH) clean
$(MAKE) -C $(XRAWDATA2_PATH) clean
$(MAKE) -C $(XRAWDATA3_PATH) clean
endef
define clean_ethernet_driver
echo Cleaning Ethernet Driver
$(MAKE) -C $(XDMA_PATH) clean
$(MAKE) -C $(XETHERNET0_PATH) clean
#$(MAKE) -C $(XETHERNET1_PATH) clean
#$(MAKE) -C $(XETHERNET2_PATH) clean
#$(MAKE) -C $(XETHERNET3_PATH) clean
endef
define insert_performance_driver
echo Inserting Performance Driver
$(INSMOD) $(XDMA_PATH)/$(DMA_DRIVER_NAME); sleep $(SLEEP_TIME)
$(MKNOD_CMD) /dev/$(DMA_STATS_FILE) c $(MKNOD) 0
$(INSMOD) $(XRAWDATA0_PATH)/$(RAW0_DRIVER_NAME); sleep $(SLEEP_TIME)
$(MKNOD_CMD) /dev/$(RAW0_FILE_NAME) c $(MKNOD0) 0
# $(INSMOD) $(XRAWDATA1_PATH)/$(RAW1_DRIVER_NAME)
# $(MKNOD_CMD) /dev/$(RAW1_FILE_NAME) c $(MKNOD1) 0
endef
define insert_rawethernet_driver
echo Inserting Raw Ethernet Driver
$(INSMOD) $(XDMA_PATH)/$(DMA_DRIVER_NAME); sleep $(SLEEP_TIME)
$(MKNOD_CMD) /dev/$(DMA_STATS_FILE) c $(MKNOD) 0
$(INSMOD) $(XRAWDATA0_PATH)/$(RAW0_DRIVER_NAME); sleep $(SLEEP_TIME)
$(MKNOD_CMD) /dev/$(RAW0_FILE_NAME) c $(MKNOD0) 0
$(INSMOD) $(XRAWDATA1_PATH)/$(RAW1_DRIVER_NAME)
$(MKNOD_CMD) /dev/$(RAW1_FILE_NAME) c $(MKNOD1) 0
$(INSMOD) $(XRAWDATA2_PATH)/$(RAW2_DRIVER_NAME); sleep $(SLEEP_TIME)
$(MKNOD_CMD) /dev/$(RAW2_FILE_NAME) c $(MKNOD2) 0
$(INSMOD) $(XRAWDATA3_PATH)/$(RAW3_DRIVER_NAME)
$(MKNOD_CMD) /dev/$(RAW3_FILE_NAME) c $(MKNOD3) 0
endef
define insert_ethernet_driver
echo Inserting Ethernet Driver
$(INSMOD) $(XDMA_PATH)/$(DMA_DRIVER_NAME); sleep $(SLEEP_TIME)
$(MKNOD_CMD) /dev/$(DMA_STATS_FILE) c $(MKNOD) 0
$(INSMOD) $(XETHERNET0_PATH)/$(XETHERNET0_DRIVER_NAME); sleep $(SLEEP_TIME)
#$(INSMOD) $(XETHERNET1_PATH)/$(XETHERNET1_DRIVER_NAME); sleep $(SLEEP_TIME)
#$(INSMOD) $(XETHERNET2_PATH)/$(XETHERNET2_DRIVER_NAME); sleep $(SLEEP_TIME)
#$(INSMOD) $(XETHERNET3_PATH)/$(XETHERNET3_DRIVER_NAME)
endef
define remove_performance_driver
echo Removing Performance Driver
# $(RMMOD) $(RAW1_DRIVER_NAME); sleep $(SLEEP_TIME)
$(RMMOD) $(RAW0_DRIVER_NAME); sleep $(SLEEP_TIME); $(RM) -f /dev/$(DMA_STATS_FILE)
# $(RM) -f /dev/$(RAW1_FILE_NAME);
$(RM) -f /dev/$(RAW0_FILE_NAME)
$(RMMOD) $(DMA_DRIVER_NAME)
endef
define remove_rawethernet_driver
echo Removing Raw Ethernet Driver
$(RMMOD) $(RAW3_DRIVER_NAME); sleep $(SLEEP_TIME)
$(RMMOD) $(RAW2_DRIVER_NAME); sleep $(SLEEP_TIME)
$(RMMOD) $(RAW1_DRIVER_NAME); sleep $(SLEEP_TIME)
$(RMMOD) $(RAW0_DRIVER_NAME); sleep $(SLEEP_TIME)
$(RM) -f /dev/$(RAW3_FILE_NAME);$(RM) -f /dev/$(RAW2_FILE_NAME)
$(RM) -f /dev/$(RAW1_FILE_NAME);$(RM) -f /dev/$(RAW0_FILE_NAME)
$(RMMOD) $(DMA_DRIVER_NAME);$(RM) -f /dev/$(DMA_STATS_FILE)
endef
define remove_ethernet_driver
echo Removing Ethernet Driver
#$(RMMOD) $(XETHERNET3_DRIVER_NAME); sleep $(SLEEP_TIME)
#$(RMMOD) $(XETHERNET2_DRIVER_NAME); sleep $(SLEEP_TIME)
#$(RMMOD) $(XETHERNET1_DRIVER_NAME); sleep $(SLEEP_TIME)
$(RMMOD) $(XETHERNET0_DRIVER_NAME); sleep $(SLEEP_TIME); $(RM) -f /dev/$(DMA_STATS_FILE)
$(RMMOD) $(DMA_DRIVER_NAME)
endef