X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fsoftnic%2Fparser.c;h=dc15ec8aa2b97bc056dc9141db2a8e03a42e443b;hb=397b4b3c509574a55c58ae161f5a01cc8a4da56a;hp=7087b8783386f56450b0e59c6a77e16b55f4438a;hpb=31ce8d888625e45019eac7fa9145edc57911e897;p=dpdk.git diff --git a/drivers/net/softnic/parser.c b/drivers/net/softnic/parser.c index 7087b87833..dc15ec8aa2 100644 --- a/drivers/net/softnic/parser.c +++ b/drivers/net/softnic/parser.c @@ -92,6 +92,24 @@ softnic_parser_read_arg_bool(const char *p) return result; } +int +softnic_parser_read_int32(int32_t *value, const char *p) +{ + char *next; + int32_t val; + + p = skip_white_spaces(p); + if (!isdigit(*p)) + return -EINVAL; + + val = strtol(p, &next, 10); + if (p == next) + return -EINVAL; + + *value = val; + return 0; +} + int softnic_parser_read_uint64(uint64_t *value, const char *p) { @@ -510,13 +528,13 @@ inet_pton6(const char *src, unsigned char *dst) return 1; } -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; - unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + unsigned long o[RTE_ETHER_ADDR_LEN]; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -532,14 +550,14 @@ my_ether_aton(const char *a) return NULL; /* Support the format XX:XX:XX:XX:XX:XX */ - if (i == ETHER_ADDR_LEN) { + if (i == RTE_ETHER_ADDR_LEN) { while (i-- != 0) { if (o[i] > UINT8_MAX) return NULL; ether_addr.addr_bytes[i] = (uint8_t)o[i]; } /* Support the format XXXX:XXXX:XXXX */ - } else if (i == ETHER_ADDR_LEN / 2) { + } else if (i == RTE_ETHER_ADDR_LEN / 2) { while (i-- != 0) { if (o[i] > UINT16_MAX) return NULL; @@ -550,7 +568,7 @@ my_ether_aton(const char *a) } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -578,15 +596,15 @@ softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6) } int -softnic_parse_mac_addr(const char *token, struct ether_addr *addr) +softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr) { - struct ether_addr *tmp; + struct rte_ether_addr *tmp; tmp = my_ether_aton(token); if (tmp == NULL) return -1; - memcpy(addr, tmp, sizeof(struct ether_addr)); + memcpy(addr, tmp, sizeof(struct rte_ether_addr)); return 0; }