]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
virtchnl: Use the BIT() macro for capability/offload flags
authorBrett Creeley <brett.creeley@intel.com>
Fri, 7 May 2021 22:09:11 +0000 (15:09 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Fri, 29 Oct 2021 20:11:53 +0000 (13:11 -0700)
Currently raw hex values are used to define specific bits for each
capability/offload in virtchnl.h. Using raw hex values makes it
unclear which bits are used/available. Fix this by using the BIT()
macro so it's immediately obvious which bits are used/available.

Also, move the VIRTCHNL_VF_CAP_ADV_LINK_SPEED define in the correct
place to line up with the other bit values and add a comment for its
purpose.

Signed-off-by: Brett Creeley <brett.creeley@intel.com>
Tested-by: Tony Brelinski <tony.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
include/linux/avf/virtchnl.h

index 2e1e1379b569a35c4d8643b46830221f337d7503..b30a1bc74fc7e955e65b5568e5dd438b569359c8 100644 (file)
@@ -238,26 +238,26 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
  * VIRTCHNL_VF_OFFLOAD_L2 flag is inclusive of base mode L2 offloads including
  * TX/RX Checksum offloading and TSO for non-tunnelled packets.
  */
-#define VIRTCHNL_VF_OFFLOAD_L2                 0x00000001
-#define VIRTCHNL_VF_OFFLOAD_IWARP              0x00000002
-#define VIRTCHNL_VF_OFFLOAD_RSS_AQ             0x00000008
-#define VIRTCHNL_VF_OFFLOAD_RSS_REG            0x00000010
-#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR          0x00000020
-#define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES         0x00000040
-#define VIRTCHNL_VF_OFFLOAD_VLAN               0x00010000
-#define VIRTCHNL_VF_OFFLOAD_RX_POLLING         0x00020000
-#define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2      0x00040000
-#define VIRTCHNL_VF_OFFLOAD_RSS_PF             0X00080000
-#define VIRTCHNL_VF_OFFLOAD_ENCAP              0X00100000
-#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM         0X00200000
-#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM      0X00400000
-#define VIRTCHNL_VF_OFFLOAD_ADQ                        0X00800000
-#define VIRTCHNL_VF_OFFLOAD_USO                        0X02000000
-#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF         0X08000000
-#define VIRTCHNL_VF_OFFLOAD_FDIR_PF            0X10000000
-
-/* Define below the capability flags that are not offloads */
-#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED         0x00000080
+#define VIRTCHNL_VF_OFFLOAD_L2                 BIT(0)
+#define VIRTCHNL_VF_OFFLOAD_IWARP              BIT(1)
+#define VIRTCHNL_VF_OFFLOAD_RSS_AQ             BIT(3)
+#define VIRTCHNL_VF_OFFLOAD_RSS_REG            BIT(4)
+#define VIRTCHNL_VF_OFFLOAD_WB_ON_ITR          BIT(5)
+#define VIRTCHNL_VF_OFFLOAD_REQ_QUEUES         BIT(6)
+/* used to negotiate communicating link speeds in Mbps */
+#define VIRTCHNL_VF_CAP_ADV_LINK_SPEED         BIT(7)
+#define VIRTCHNL_VF_OFFLOAD_VLAN               BIT(16)
+#define VIRTCHNL_VF_OFFLOAD_RX_POLLING         BIT(17)
+#define VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2      BIT(18)
+#define VIRTCHNL_VF_OFFLOAD_RSS_PF             BIT(19)
+#define VIRTCHNL_VF_OFFLOAD_ENCAP              BIT(20)
+#define VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM         BIT(21)
+#define VIRTCHNL_VF_OFFLOAD_RX_ENCAP_CSUM      BIT(22)
+#define VIRTCHNL_VF_OFFLOAD_ADQ                        BIT(23)
+#define VIRTCHNL_VF_OFFLOAD_USO                        BIT(25)
+#define VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF         BIT(27)
+#define VIRTCHNL_VF_OFFLOAD_FDIR_PF            BIT(28)
+
 #define VF_BASE_MODE_OFFLOADS (VIRTCHNL_VF_OFFLOAD_L2 | \
                               VIRTCHNL_VF_OFFLOAD_VLAN | \
                               VIRTCHNL_VF_OFFLOAD_RSS_PF)