MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ip4_rewrite_node_add

Function ip4_rewrite_node_add

dpdk/app/graph/neigh.c:106–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104}
105
106static int
107ip4_rewrite_node_add(struct neigh_ipv4_config *v4_config)
108{
109 uint8_t data[2 * RTE_ETHER_ADDR_LEN];
110 uint8_t len = 2 * RTE_ETHER_ADDR_LEN;
111 struct rte_ether_addr smac;
112 int16_t portid = 0;
113 int rc;
114
115 portid = ethdev_portid_by_ip4(v4_config->ip, 0);
116 if (portid < 0) {
117 printf("Invalid portid found to add neigh\n");
118 return -EINVAL;
119 }
120
121 memset(data, 0, len);
122
123 /* Copy dst mac */
124 rte_memcpy((void *)&data[0], (void *)&v4_config->mac, RTE_ETHER_ADDR_LEN);
125
126 /* Copy src mac */
127 rc = rte_eth_macaddr_get(portid, &smac);
128 if (rc < 0) {
129 printf("Cannot get MAC address: err=%d, port=%d\n", rc, portid);
130 return rc;
131 }
132
133 rte_memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN);
134
135 return rte_node_ip4_rewrite_add(portid, data, len, portid);
136}
137
138
139static int

Callers 2

neigh_ip4_addFunction · 0.85
neigh_ip4_add_to_rewriteFunction · 0.85

Calls 6

ethdev_portid_by_ip4Function · 0.85
memsetFunction · 0.85
rte_eth_macaddr_getFunction · 0.85
rte_node_ip4_rewrite_addFunction · 0.85
printfFunction · 0.50
rte_memcpyFunction · 0.50

Tested by

no test coverage detected