igc: Simplify setting flags in the TX data descriptor
authorVinicius Costa Gomes <vinicius.gomes@intel.com>
Fri, 22 Sep 2023 01:40:48 +0000 (18:40 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 13 Nov 2023 23:17:08 +0000 (15:17 -0800)
We can re-use the IGC_SET_FLAG() macro to simplify setting some values
in the TX data descriptor. With the macro it's easier to get the
meaning of the operations.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/igc/igc_main.c

index e9bb403bbacf9d52c034efa3d5d288de058ba418..7059710154eb1102fce22f9c8f206fe1e0e27b4a 100644 (file)
@@ -1299,14 +1299,12 @@ static void igc_tx_olinfo_status(struct igc_ring *tx_ring,
        u32 olinfo_status = paylen << IGC_ADVTXD_PAYLEN_SHIFT;
 
        /* insert L4 checksum */
-       olinfo_status |= (tx_flags & IGC_TX_FLAGS_CSUM) *
-                         ((IGC_TXD_POPTS_TXSM << 8) /
-                         IGC_TX_FLAGS_CSUM);
+       olinfo_status |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_CSUM,
+                                     (IGC_TXD_POPTS_TXSM << 8));
 
        /* insert IPv4 checksum */
-       olinfo_status |= (tx_flags & IGC_TX_FLAGS_IPV4) *
-                         (((IGC_TXD_POPTS_IXSM << 8)) /
-                         IGC_TX_FLAGS_IPV4);
+       olinfo_status |= IGC_SET_FLAG(tx_flags, IGC_TX_FLAGS_IPV4,
+                                     (IGC_TXD_POPTS_IXSM << 8));
 
        tx_desc->read.olinfo_status = cpu_to_le32(olinfo_status);
 }