OSDN Git Service

ice: switch: use a struct to pass packet template params
authorAlexander Lobakin <alexandr.lobakin@intel.com>
Mon, 21 Mar 2022 10:59:52 +0000 (11:59 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 7 Apr 2022 15:20:10 +0000 (08:20 -0700)
commit1b699f81dba78c724f6f94b02f01e216b64bf88b
tree341b963df41a2c6e8052acb0b7f7d98a12d69359
parent27ffa273a0405b546b4562b1c65e616d41a1f30e
ice: switch: use a struct to pass packet template params

ice_find_dummy_packet() contains a lot of boilerplate code and a
nice room for copy-paste mistakes.
Instead of passing 3 separate pointers back and forth to get packet
template (dummy) params, directly return a structure containing
them. Then, use a macro to compose compound literals and avoid code
duplication on return path.
Now, dummy packet type/name is needed only once to return a full
correct triple pkt-pkt_len-offsets, and those are all one-liners.
dummy_ipv4_gtpu_ipv4_packet_offsets is just moved around and renamed
(as well as dummy_ipv6_gtp_packet_offsets) with no function changes.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_switch.c