diff options
| author | root <[email protected]> | 2015-07-06 16:50:18 +0800 |
|---|---|---|
| committer | root <[email protected]> | 2015-07-06 16:50:18 +0800 |
| commit | 8439d3388d9fb166ec52505082e8d772dad3c7e7 (patch) | |
| tree | 6a8c43804e6493895297701fbcc78f67018bf2c9 | |
| parent | d7742b8a2075805a6326d141c6c9b6c35a5e2dfb (diff) | |
增加Git版本号机制,修改刷屏显示最下行没有的问题。20150706
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | driver/Makefile | 4 | ||||
| -rw-r--r-- | driver/main.c | 84 | ||||
| -rw-r--r-- | driver/nstat.c | 3 | ||||
| -rw-r--r-- | driver/version.c | 12 | ||||
| -rw-r--r-- | driver/version.h | 4 | ||||
| -rw-r--r-- | logreader/dlogreader/nstat.c | 2 | ||||
| -rw-r--r-- | worker/Makefile | 4 | ||||
| -rw-r--r-- | worker/version.c | 15 |
9 files changed, 46 insertions, 85 deletions
@@ -31,6 +31,7 @@ APP_ROOT = $(CURDIR) MK_ROOT = $(CURDIR)/mk
INSTALL = $(CURDIR)/build
LIB_INSTALL = /usr/lib
+GITVER = $(shell git describe --long)
include mk/config.mk
@@ -60,6 +61,7 @@ export APP_ROOT export MK_ROOT
export INSTALL
export LIB_INSTALL
+export GITVER
WORKER = worker
DRIVER = driver
@@ -76,6 +78,7 @@ ifeq ($(RTE_TARGET),) $(error "Please define RTE_TARGET environment variable")
endif
+
.PHONY: install clean
all:
diff --git a/driver/Makefile b/driver/Makefile index 9125bce..d72d114 100644 --- a/driver/Makefile +++ b/driver/Makefile @@ -5,6 +5,10 @@ ifeq ($(MODULES_STATS),0) MODULES_CFAGS += -DAPP_STAT=0
endif
+ifneq ($(GITVER),)
+ CFLAGS += -DGITVER=\"$(GITVER)\"
+endif
+
TARGET = driver
MAJOR_VERSION = 1
SUB_VERSION = 1
diff --git a/driver/main.c b/driver/main.c index 1f14991..a9abb29 100644 --- a/driver/main.c +++ b/driver/main.c @@ -38,82 +38,11 @@ #include "main.h" #include "apt.h" #include "nstat.h" - +#include "version.h" FILE *warn_output_stream = NULL; FILE *err_output_stream = NULL; -#if 0 -static inline struct rte_mbuf * rte_rxmbuf_alloc(struct rte_mempool *mp) -{ - struct rte_mbuf *m; - m = __rte_mbuf_raw_alloc(mp); - __rte_mbuf_sanity_check_raw(m,RTE_MBUF_PKT,0); - - return (m); -} - -int dpdk_register_callfunc(int (*func)(const unsigned char *data,int datalen,int port_in,int lcore)) -{ - app.pkt_callback_f.rx_pkt_process = func; - app.pkt_callback_f.rx_pkt_process_dst = NULL; - return 0; -} - -int dpdk_register_callfunc_dst(int (*func)(const unsigned char *data,int datalen,int dst,int lcore)) -{ - app.pkt_callback_f.rx_pkt_process_dst = func; - app.pkt_callback_f.rx_pkt_process = NULL; - return 0; -} - -int dpdk_send_packet_dst(unsigned char *data, int datalen, int dst) -{ - if(dst <0 || dst >= (int)app.n_rxtx_stream) - return -1; - uint32_t port = app.rxtx_stream_record[dst].tx_port; - - return dpdk_send_packet_port(data,datalen,port); -} - -int app_lcore_worker_tx_buffer_to_send (struct rte_mbuf *pkt, uint8_t port); -#endif -#if 0 -int dpdk_send_packet_port(const unsigned char *data, int datalen, int port) -{ - struct rte_mbuf * pkt_burst = NULL; - - int lcore_id = rte_lcore_id(); - - if(data == NULL) { - fprintf(warn_output_stream,"WARNING(core_id=%d,datalen=%d): Invalid TX packet info, ignore the pkt.\n", - lcore_id,datalen); - return -1; - } - - pkt_burst = rte_rxmbuf_alloc(app.lcore_params[lcore_id].pool); - - if(pkt_burst == NULL) { - fprintf(warn_output_stream,"WARNING(core_id=%d),Alloc mbuf failed,ignore the pkt\n", - lcore_id); - return -1; - } - - pkt_burst->pkt.nb_segs = 1; - pkt_burst->pkt.next = NULL; - pkt_burst->pkt.in_port = port; - pkt_burst->pkt.pkt_len = datalen; - pkt_burst->pkt.data_len = datalen; - - rte_memcpy(pkt_burst->pkt.data, data, datalen); - pkt_burst->ol_flags |= PKT_TX_IP_CKSUM; - - app_lcore_worker_tx_buffer_to_send(pkt_burst,port); - - return 0; -} -#endif - void sigint_handler(int signo) { uint8_t portid; @@ -131,15 +60,15 @@ void sigint_handler(int signo) #ifndef NL2FWD_APT_MAXPARAS -#define NL2FWD_APT_MAXPARAS 2048 +#define NL2FWD_APT_MAXPARAS 2048 #endif #ifndef NL2FWD_APT_STRING_MAX -#define NL2FWD_APT_STRING_MAX 2048 +#define NL2FWD_APT_STRING_MAX 2048 #endif #ifndef NL2FWD_APT_ENABLE -#define NL2FWD_APT_ENABLE 1 +#define NL2FWD_APT_ENABLE 1 #endif int dpdk_init_apt(); @@ -148,8 +77,9 @@ int dpdk_init_t(int argc, char **argv); int main(int argc,char **argv) { - printf("Starting Serial-Multiprocess DRIVER \n"); - printf("Compile with Intel DPDK %s\n",rte_version()); + printf("\33[;32mPacket I/O Middleware for PAPP/SAPP/START DRIVER \033[0m \n"); + printf("\33[;32mVersion: %s(%s) %s\33[0m \n", serial_version,serial_git_version,rte_version()); + #if NL2FWD_APT_ENABLE dpdk_init_apt(); #else diff --git a/driver/nstat.c b/driver/nstat.c index bb142bf..4959890 100644 --- a/driver/nstat.c +++ b/driver/nstat.c @@ -267,7 +267,7 @@ void nstat_print_loop(struct nstat_handle * handle_now, struct nstat_handle * ha }
fprintf(fstream,"--------------------------------------------------------------------------------------------------------------------------------------\n");
- fprintf(fstream," Input/Output(I/O) Statistics \n");
+ fprintf(fstream," Input/Output(I/O) Statistics \n");
fprintf(fstream,"--------------------------------------------------------------------------------------------------------------------------------------\n");
for(int lcore_id = 0; lcore_id < APP_MAX_LCORES; lcore_id++)
@@ -355,5 +355,6 @@ void nstat_print_loop(struct nstat_handle * handle_now, struct nstat_handle * ha }
}
#endif
+ fprintf(fstream,"--------------------------------------------------------------------------------------------------------------------------------------\n");
return;
}
diff --git a/driver/version.c b/driver/version.c index 1df34c4..5a5dbc6 100644 --- a/driver/version.c +++ b/driver/version.c @@ -1,5 +1,13 @@ #include "version.h" -const char __serial_driver_version_20150104__[] __attribute__((used)) = "__SERIAL_DRIVER_VERSION_20150104__"; -const char __SERIAL_DRIVER_VERSION_20150104__[] __attribute__((used)) = "__serial_driver_version_20150104__"; +const char __serial_driver_version_20150706__[] __attribute__((used)) = "__SERIAL_DRIVER_VERSION_20150706__"; +const char __SERIAL_DRIVER_VERSION_20150706__[] __attribute__((used)) = "__serial_driver_version_20150706__"; + +const char serial_version[] = "20150706"; + +#ifdef GITVER +const char serial_git_version[] = GITVER; +#else +const char serial_git_version[] = ""; +#endif diff --git a/driver/version.h b/driver/version.h index 5c421b1..24e67b5 100644 --- a/driver/version.h +++ b/driver/version.h @@ -2,8 +2,8 @@ #ifndef __VERSION_LIB_INCLUDE_H__ #define __VERSION_LIB_INCLUDE_H__ -extern const char __serial_version_info__[]; -extern const char __serial_version_platform__[]; +const char serial_version[]; +const char serial_git_version[]; #endif diff --git a/logreader/dlogreader/nstat.c b/logreader/dlogreader/nstat.c index f74fccb..724e8b8 100644 --- a/logreader/dlogreader/nstat.c +++ b/logreader/dlogreader/nstat.c @@ -167,7 +167,7 @@ void nstat_print_loop(struct nstat_handle * handle_now, struct nstat_handle * ha }
fprintf(fstream,"--------------------------------------------------------------------------------------------------------------------------------------\n");
- fprintf(fstream," Input/Output(I/O) Statistics \n");
+ fprintf(fstream," Input/Output(I/O) Statistics \n");
fprintf(fstream,"--------------------------------------------------------------------------------------------------------------------------------------\n");
for(int lcore_id = 0; lcore_id < APP_MAX_LCORES; lcore_id++)
diff --git a/worker/Makefile b/worker/Makefile index 4efcf33..c4c6f41 100644 --- a/worker/Makefile +++ b/worker/Makefile @@ -1,6 +1,10 @@ include $(MK_ROOT)/config.mk
+ifneq ($(GITVER),)
+ CFLAGS += -DGITVER=\"$(GITVER)\"
+endif
+
MAJOR_VERSION = 1
SUB_VERSION = 1
diff --git a/worker/version.c b/worker/version.c index 0079c59..5a5dbc6 100644 --- a/worker/version.c +++ b/worker/version.c @@ -1,2 +1,13 @@ -const char __serial_worker_version_20150104__[] __attribute__((used)) = "__SERIAL_WORKER_VERSION_20150104__"; -const char __SERIAL_WORKER_VERSION_20150104__[] __attribute__((used)) = "__SERIAL_WORKER_VERSION_20150104__"; + +#include "version.h" + +const char __serial_driver_version_20150706__[] __attribute__((used)) = "__SERIAL_DRIVER_VERSION_20150706__"; +const char __SERIAL_DRIVER_VERSION_20150706__[] __attribute__((used)) = "__serial_driver_version_20150706__"; + +const char serial_version[] = "20150706"; + +#ifdef GITVER +const char serial_git_version[] = GITVER; +#else +const char serial_git_version[] = ""; +#endif |
