This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via 3ca26420f0e06fdb1b2cb9192461dbc32a421de5 (commit) from b50cf14202528e986ae9a41721fae1e746078646 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 3ca26420f0e06fdb1b2cb9192461dbc32a421de5 Author: Bogdan Pricope bogdan.pricope@linaro.org Date: Wed May 3 10:42:25 2017 +0300
examples: generator: UDP ports configuration
Signed-off-by: Bogdan Pricope bogdan.pricope@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index ede1cdf2..79efe5bb 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -64,6 +64,8 @@ typedef struct { odph_ethaddr_t dstmac; /**< dest mac addr */ unsigned int srcip; /**< src ip addr */ unsigned int dstip; /**< dest ip addr */ + uint16_t srcport; /**< src udp port */ + uint16_t dstport; /**< dest udp port */ int mode; /**< work mode */ int number; /**< packets number to be sent */ int payload; /**< data len */ @@ -233,8 +235,8 @@ static odp_packet_t setup_udp_pkt_ref(odp_pool_t pool) odp_packet_l4_offset_set(pkt, ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); odp_packet_has_udp_set(pkt, 1); udp = (odph_udphdr_t *)(buf + ODPH_ETHHDR_LEN + ODPH_IPV4HDR_LEN); - udp->src_port = 0; - udp->dst_port = 0; + udp->src_port = odp_cpu_to_be_16(args->appl.srcport); + udp->dst_port = odp_cpu_to_be_16(args->appl.dstport); udp->length = odp_cpu_to_be_16(args->appl.payload + ODPH_UDPHDR_LEN); udp->chksum = 0; udp->chksum = odph_ipv4_udp_chksum(pkt); @@ -1143,6 +1145,8 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {"dstmac", required_argument, NULL, 'b'}, {"srcip", required_argument, NULL, 's'}, {"dstip", required_argument, NULL, 'd'}, + {"srcport", required_argument, NULL, 'e'}, + {"dstport", required_argument, NULL, 'f'}, {"packetsize", required_argument, NULL, 'p'}, {"mode", required_argument, NULL, 'm'}, {"count", required_argument, NULL, 'n'}, @@ -1153,7 +1157,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {NULL, 0, NULL, 0} };
- static const char *shortopts = "+I:a:b:s:d:p:i:m:n:t:w:c:x:h"; + static const char *shortopts = "+I:a:b:s:d:p:i:m:n:t:w:c:x:he:f:";
/* let helper collect its own arguments (e.g. --odph_proc) */ odph_parse_options(argc, argv, shortopts, longopts); @@ -1164,6 +1168,8 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->timeout = -1; appl_args->interval = DEFAULT_PKT_INTERVAL; appl_args->udp_tx_burst = 16; + appl_args->srcport = 0; + appl_args->dstport = 0;
opterr = 0; /* do not issue errors on helper options */
@@ -1270,6 +1276,12 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) } break;
+ case 'e': + appl_args->srcport = (unsigned short)atoi(optarg); + break; + case 'f': + appl_args->dstport = (unsigned short)atoi(optarg); + break; case 'p': appl_args->payload = atoi(optarg); break; @@ -1383,6 +1395,8 @@ static void usage(char *progname) "\n" "Optional OPTIONS\n" " -h, --help Display help and exit.\n" + " -e, --srcport src udp port\n" + " -f, --dstport dst udp port\n" " -p, --packetsize payload length of the packets\n" " -t, --timeout only for ping mode, wait ICMP reply timeout seconds\n" " -i, --interval wait interval ms between sending each packet\n"
-----------------------------------------------------------------------
Summary of changes: example/generator/odp_generator.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
hooks/post-receive