]> www.infradead.org Git - users/dwmw2/linux.git/commit
net: netconsole: split send_msg_fragmented
authorBreno Leitao <leitao@debian.org>
Thu, 17 Oct 2024 09:50:24 +0000 (02:50 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 22 Oct 2024 13:44:25 +0000 (15:44 +0200)
commit60be416c6380c2098126b126ef918237b40815f7
tree71fa546efbdbb0798251a20873fb6bfd63f24b58
parent144d57360f5e9af7a836dcc33d12560de90a7d9d
net: netconsole: split send_msg_fragmented

Refactor the send_msg_fragmented() function by extracting the logic for
sending the message body into a new function called
send_fragmented_body().

Now, send_msg_fragmented() handles appending the release and header, and
then delegates the task of breaking up the body and sending the
fragments to send_fragmented_body().

This is the final flow now:

When send_ext_msg_udp() is called to send a message, it will:
  - call send_msg_no_fragmentation() if no fragmentation is needed
  or
  - call send_msg_fragmented() if fragmentation is needed
    * send_msg_fragmented() appends the header to the buffer, which is
      be persisted until the function returns
      * call send_fragmented_body() to iterate and populate the body of
the message. It will not touch the header, and it will only
replace the body, writing the msgbody and/or userdata.

Also add some comment to make the code easier to review.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/netconsole.c