27 #include <rte_config.h> 29 #include <tas_memif.h> 33 #include "tcp_common.h" 36 static inline void inject_tcp_ts(
void *buf, uint16_t len, uint32_t ts,
37 struct network_buf_handle *nbh);
40 struct network_buf_handle *nbh, uint32_t ts)
42 void *buf = network_buf_buf(nbh);
45 uint32_t flow_id, len;
49 if (kctx->tx_len == 0)
52 ktx = dma_pointer(kctx->tx_base + kctx->tx_head,
sizeof(*ktx));
56 }
else if (ktx->type == FLEXTCP_PL_KTX_PACKET) {
57 len = ktx->msg.packet.len;
60 dma_read(ktx->msg.packet.addr, len, buf);
63 inject_tcp_ts(buf, len, ts, nbh);
64 tx_send(ctx, nbh, 0, len);
65 }
else if (ktx->type == FLEXTCP_PL_KTX_PACKET_NOTS) {
67 len = ktx->msg.packet.len;
70 dma_read(ktx->msg.packet.addr, len, buf);
73 tx_send(ctx, nbh, 0, len);
74 }
else if (ktx->type == FLEXTCP_PL_KTX_CONNRETRAN) {
75 flow_id = ktx->msg.connretran.flow_id;
76 if (flow_id >= FLEXNIC_PL_FLOWST_NUM) {
77 fprintf(stderr,
"fast_kernel_qman: invalid flow id=%u\n", flow_id);
81 fast_flows_retransmit(ctx, flow_id);
84 fprintf(stderr,
"fast_appctx_poll: unknown type: %u\n", ktx->type);
91 kctx->tx_head +=
sizeof(*ktx);
92 if (kctx->tx_head >= kctx->tx_len)
93 kctx->tx_head -= kctx->tx_len;
99 struct network_buf_handle *nbh)
106 if (kctx->rx_len == 0) {
110 krx = dma_pointer(kctx->rx_base + kctx->rx_head,
sizeof(*krx));
113 if (krx->type != 0) {
118 kctx->rx_head +=
sizeof(*krx);
119 if (kctx->rx_head >= kctx->rx_len)
120 kctx->rx_head -= kctx->rx_len;
123 len = network_buf_len(nbh);
124 dma_write(krx->addr, len, network_buf_bufoff(nbh));
126 if (network_buf_flowgroup(nbh, &krx->msg.packet.flow_group)) {
127 fprintf(stderr,
"fast_kernel_packet: network_buf_flowgroup failed\n");
131 krx->msg.packet.len = len;
132 krx->msg.packet.fn_core = ctx->id;
136 krx->type = FLEXTCP_PL_KRX_PACKET;
137 notify_slowpath_core();
140 static inline void inject_tcp_ts(
void *buf, uint16_t len, uint32_t ts,
141 struct network_buf_handle *nbh)
146 if (len <
sizeof(*p) || f_beui16(p->eth.type) != ETH_TYPE_IP ||
147 p->ip.proto != IP_PROTO_TCP)
152 if (tcp_parse_options(buf, len, &opts) != 0) {
153 fprintf(stderr,
"inject_tcp_ts: parsing options failed\n");
157 if (opts.ts == NULL) {
161 opts.ts->ts_val = t_beui32(ts);
163 fast_flows_kernelxsums(nbh, p);