@@ -438,6 +438,7 @@ struct tcp_out_options {
u8 ws; /* window scale, 0 to disable */
u8 num_sack_blocks; /* number of SACK blocks to include */
u8 hash_size; /* bytes in hash_location */
+ u8 pad_size; /* additional nops for padding */
__u8 *hash_location; /* temporary pointer, overloaded */
__u32 tsval, tsecr; /* need to include OPTION_TS */
struct tcp_fastopen_cookie *fastopen_cookie; /* Fast open cookie */
@@ -562,6 +563,15 @@ static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
smc_options_write(ptr, &options);
mptcp_options_write(ptr, opts);
+
+ /* pad out options for netgpu */
+ if (opts->pad_size) {
+ int len = opts->pad_size;
+ u8 *p = (u8 *)ptr;
+
+ while (len--)
+ *p++ = TCPOPT_NOP;
+ }
}
static void smc_set_option(const struct tcp_sock *tp,
@@ -824,6 +834,12 @@ static unsigned int tcp_established_options(struct sock *sk, struct sk_buff *skb
opts->num_sack_blocks * TCPOLEN_SACK_PERBLOCK;
}
+ /* force padding for netgpu */
+ if (size < 20) {
+ opts->pad_size = 20 - size;
+ size += opts->pad_size;
+ }
+
return size;
}
The "header splitting" feature used by netgpu doesn't actually parse the incoming packet header. Instead, it splits the packet at a fixed offset. In order for this to work, the sender needs to send packets with a fixed header size. (Obviously not for upstream committing, just for prototyping) Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com> --- net/ipv4/tcp_output.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)