git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vhost: introduce vDPA device class
[dpdk.git]
/
examples
/
ip_pipeline
/
parser.c
diff --git
a/examples/ip_pipeline/parser.c
b/examples/ip_pipeline/parser.c
index
0901e9c
..
fb0769f
100644
(file)
--- a/
examples/ip_pipeline/parser.c
+++ b/
examples/ip_pipeline/parser.c
@@
-36,10
+36,8
@@
#include <sys/wait.h>
#include <rte_errno.h>
#include <sys/wait.h>
#include <rte_errno.h>
-#include <rte_cfgfile.h>
#include <rte_string_fns.h>
#include <rte_string_fns.h>
-#include "app.h"
#include "parser.h"
static uint32_t
#include "parser.h"
static uint32_t
@@
-515,13
+513,13
@@
inet_pton6(const char *src, unsigned char *dst)
return 1;
}
return 1;
}
-static struct ether_addr *
+static struct
rte_
ether_addr *
my_ether_aton(const char *a)
{
int i;
char *end;
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 {
i = 0;
do {
@@
-530,21
+528,21
@@
my_ether_aton(const char *a)
if (errno != 0 || end == a || (end[0] != ':' && end[0] != 0))
return NULL;
a = end + 1;
if (errno != 0 || end == a || (end[0] != ':' && end[0] != 0))
return NULL;
a = end + 1;
- } while (++i !=
sizeof(o) / sizeof(o[0]
) && end[0] != 0);
+ } while (++i !=
RTE_DIM(o
) && end[0] != 0);
/* Junk at the end of line */
if (end[0] != 0)
return NULL;
/* Support the format XX:XX:XX:XX:XX:XX */
/* Junk at the end of line */
if (end[0] != 0)
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 */
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;
while (i-- != 0) {
if (o[i] > UINT16_MAX)
return NULL;
@@
-555,7
+553,7
@@
my_ether_aton(const char *a)
} else
return NULL;
} else
return NULL;
- return (struct ether_addr *)ðer_addr;
+ return (struct
rte_
ether_addr *)ðer_addr;
}
int
}
int
@@
-583,23
+581,21
@@
parse_ipv6_addr(const char *token, struct in6_addr *ipv6)
}
int
}
int
-parse_mac_addr(const char *token, struct ether_addr *addr)
+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;
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;
}
int
return 0;
}
int
-parse_pipeline_core(uint32_t *socket,
- uint32_t *core,
- uint32_t *ht,
- const char *entry)
+parse_cpu_core(const char *entry,
+ struct cpu_core_params *p)
{
size_t num_len;
char num[8];
{
size_t num_len;
char num[8];
@@
-609,6
+605,9
@@
parse_pipeline_core(uint32_t *socket,
const char *next = skip_white_spaces(entry);
char type;
const char *next = skip_white_spaces(entry);
char type;
+ if (p == NULL)
+ return -EINVAL;
+
/* Expect <CORE> or [sX][cY][h]. At least one parameter is required. */
while (*next != '\0') {
/* If everything parsed nothing should left */
/* Expect <CORE> or [sX][cY][h]. At least one parameter is required. */
while (*next != '\0') {
/* If everything parsed nothing should left */
@@
-682,8
+681,8
@@
parse_pipeline_core(uint32_t *socket,
}
}
}
}
-
*socket
= s;
-
*core
= c;
-
*ht
= h;
+
p->socket_id
= s;
+
p->core_id
= c;
+
p->thread_id
= h;
return 0;
}
return 0;
}