[dpdk-dev] [PATCH 42/69] net/i40e/base: change long redundant define names

Xiaolong Ye xiaolong.ye at intel.com
Mon Dec 2 08:49:08 CET 2019


There is no need to create define names that are practically a full
sentence.  If you want to describe in detail what the define is for, you
a code comment.  Define name can be abbreviated and should not contain
verbs or "actions", so abbreviate as much as possible.

These defines that were abbreviated could potentially get even shorter,
but not without adequate code comments.

Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher at intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov at intel.com>
Reviewed-by: Galazka Krzysztof <krzysztof.galazka at intel.com>
Reviewed-by: Michael Alice <alice.michael at intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye at intel.com>
---
 drivers/net/i40e/base/i40e_adminq_cmd.h | 6 +++---
 drivers/net/i40e/base/i40e_common.c     | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h
index 2d1efef69..d5548792f 100644
--- a/drivers/net/i40e/base/i40e_adminq_cmd.h
+++ b/drivers/net/i40e/base/i40e_adminq_cmd.h
@@ -2282,18 +2282,18 @@ enum i40e_aq_phy_reg_type {
 struct i40e_aqc_run_phy_activity {
 	u8	cmd_flags;
 	__le16	activity_id;
-#define I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED	0x10
+#define I40E_AQ_RUN_PHY_ACT_ID_USR_DFND			0x10
 	u8	reserved;
 	union {
 		struct {
 			__le32  dnl_opcode;
-#define I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS	0x801b
+#define I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT	0x801b
 			__le32  data;
 			u8	reserved2[4];
 		} cmd;
 		struct {
 			__le32	cmd_status;
-#define I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS		0x4
+#define I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC		0x4
 			__le32	data0;
 			__le32	data1;
 		} resp;
diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c
index cedec4dce..91aa0f587 100644
--- a/drivers/net/i40e/base/i40e_common.c
+++ b/drivers/net/i40e/base/i40e_common.c
@@ -7182,11 +7182,11 @@ enum i40e_status_code i40e_get_lpi_counters(struct i40e_hw *hw,
 		u32 cmd_status;
 
 		retval = i40e_aq_run_phy_activity(hw,
-			I40E_AQ_RUN_PHY_ACTIVITY_ACTIVITY_ID_USER_DEFINED,
-			I40E_AQ_RUN_PHY_ACTIVITY_DNL_OPCODE_GET_EEE_STATISTICS,
-			&cmd_status, tx_counter, rx_counter, NULL);
+				I40E_AQ_RUN_PHY_ACT_ID_USR_DFND,
+				I40E_AQ_RUN_PHY_ACT_DNL_OPCODE_GET_EEE_STAT,
+				&cmd_status, tx_counter, rx_counter, NULL);
 
-		if (cmd_status != I40E_AQ_RUN_PHY_ACTIVITY_CMD_STATUS_SUCCESS)
+		if (cmd_status != I40E_AQ_RUN_PHY_ACT_CMD_STAT_SUCC)
 			retval = I40E_ERR_ADMIN_QUEUE_ERROR;
 
 		return retval;
-- 
2.17.1



More information about the dev mailing list