GRE remove gre and ipv4 header and retain space for ethernet
header. In case of Eth over GRE remove external eth, gre and ipv4
headers and return pointer to payload */
GRE remove gre and ipv4 header and retain space for ethernet
header. In case of Eth over GRE remove external eth, gre and ipv4
headers and return pointer to payload */
- /* retain sizeof(struct ether_hdr) */
- hsize = sizeof(struct ipv4_hdr) + sizeof(struct gre_hdr);
+ /* retain sizeof(prox_rte_ether_hdr) */
+ hsize = sizeof(prox_rte_ipv4_hdr) + sizeof(struct gre_hdr);
if (pip->next_proto_id != IPPROTO_GRE) {
plog_warn("Invalid packet proto_id = 0x%x expect 0x%x\n",
if (pip->next_proto_id != IPPROTO_GRE) {
plog_warn("Invalid packet proto_id = 0x%x expect 0x%x\n",
.d_addr = {.addr_bytes =
{0x0A, 0x02, 0x0A, 0x0A, 0x00, 0x01}},
.s_addr = {.addr_bytes =
.d_addr = {.addr_bytes =
{0x0A, 0x02, 0x0A, 0x0A, 0x00, 0x01}},
.s_addr = {.addr_bytes =
eth.s_addr.addr_bytes[3] = (hip >> 16) & 0xFF;
eth.s_addr.addr_bytes[4] = (hip >> 8) & 0xFF;
eth.s_addr.addr_bytes[5] = (hip) & 0xFF;
eth.s_addr.addr_bytes[3] = (hip >> 16) & 0xFF;
eth.s_addr.addr_bytes[4] = (hip >> 8) & 0xFF;
eth.s_addr.addr_bytes[5] = (hip) & 0xFF;
}
rte_memcpy(&task->cpe_gre_data[hash_index], &data, sizeof(data));
if (task->runtime_flags & TASK_TX_CRC) {
}
rte_memcpy(&task->cpe_gre_data[hash_index], &data, sizeof(data));
if (task->runtime_flags & TASK_TX_CRC) {
- prox_ip_cksum(mbuf, pip, sizeof(struct ether_hdr), sizeof(struct ipv4_hdr), task->offload_crc);
+ prox_ip_cksum(mbuf, pip, sizeof(prox_rte_ether_hdr), sizeof(prox_rte_ipv4_hdr), task->offload_crc);
static inline void handle_gre_encap16(struct task_gre_decap *task, struct rte_mbuf **mbufs, uint16_t n_pkts, uint8_t *out)
{
for (uint8_t i = 0; i < n_pkts; ++i) {
static inline void handle_gre_encap16(struct task_gre_decap *task, struct rte_mbuf **mbufs, uint16_t n_pkts, uint8_t *out)
{
for (uint8_t i = 0; i < n_pkts; ++i) {
- struct ether_hdr *peth = rte_pktmbuf_mtod(mbufs[i], struct ether_hdr *);
- ether_addr_copy(&peth->d_addr, &task->key[i].clt_mac);
+ prox_rte_ether_hdr *peth = rte_pktmbuf_mtod(mbufs[i], prox_rte_ether_hdr *);
+ prox_rte_ether_addr_copy(&peth->d_addr, &task->key[i].clt_mac);
#else
static inline uint8_t handle_gre_encap(struct task_gre_decap *task, struct rte_mbuf *mbuf, struct cpe_gre_data *table)
{
#else
static inline uint8_t handle_gre_encap(struct task_gre_decap *task, struct rte_mbuf *mbuf, struct cpe_gre_data *table)
{
- struct ether_hdr *peth = rte_pktmbuf_mtod(mbuf, struct ether_hdr *);
- struct ipv4_hdr *pip = (struct ipv4_hdr *)(peth + 1);
+ prox_rte_ether_hdr *peth = rte_pktmbuf_mtod(mbuf, prox_rte_ether_hdr *);
+ prox_rte_ipv4_hdr *pip = (prox_rte_ipv4_hdr *)(peth + 1);
uint64_t tsc_now = rte_rdtsc();
if (table->tp_tbsize < pkt_size) {
uint64_t cycles_diff = tsc_now - table->tp_tsc;
uint64_t tsc_now = rte_rdtsc();
if (table->tp_tbsize < pkt_size) {
uint64_t cycles_diff = tsc_now - table->tp_tsc;
/* reuse ethernet header from payload, retain payload (ip) in
case of DO_ENC_IP_OVER_GRE */
/* reuse ethernet header from payload, retain payload (ip) in
case of DO_ENC_IP_OVER_GRE */
.d_addr = {.addr_bytes = {0x0A, 0x0A, 0x0A, 0xC8, 0x00, 0x02}},
.s_addr = {.addr_bytes = {0x0A, 0x0A, 0x0A, 0xC8, 0x00, 0x01}},
.ether_type = ETYPE_IPv4
};
.d_addr = {.addr_bytes = {0x0A, 0x0A, 0x0A, 0xC8, 0x00, 0x02}},
.s_addr = {.addr_bytes = {0x0A, 0x0A, 0x0A, 0xC8, 0x00, 0x01}},
.ether_type = ETYPE_IPv4
};
pip->src_addr = 0x02010a0a; //emulate port ip
pip->dst_addr = table->cpe_ip;
pip->total_length = rte_cpu_to_be_16(ip_len);
if (task->runtime_flags & TASK_TX_CRC) {
pip->src_addr = 0x02010a0a; //emulate port ip
pip->dst_addr = table->cpe_ip;
pip->total_length = rte_cpu_to_be_16(ip_len);
if (task->runtime_flags & TASK_TX_CRC) {
- prox_ip_cksum(mbuf, pip, sizeof(struct ether_hdr), sizeof(struct ipv4_hdr), task->offload_crc);
+ prox_ip_cksum(mbuf, pip, sizeof(prox_rte_ether_hdr), sizeof(prox_rte_ipv4_hdr), task->offload_crc);