DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiao Wang <xiao.w.wang@intel.com>
To: wenzhuo.lu@intel.com
Cc: dev@dpdk.org, ferruh.yigit@intel.com, Xiao Wang <xiao.w.wang@intel.com>
Subject: [dpdk-dev] [PATCH v2 06/40] net/ixgbe/base: introduce new ops init functions
Date: Sun, 25 Sep 2016 16:59:43 +0800	[thread overview]
Message-ID: <1474794017-5896-7-git-send-email-xiao.w.wang@intel.com> (raw)
In-Reply-To: <1474794017-5896-1-git-send-email-xiao.w.wang@intel.com>

This patch introduces new init_ops functions for X550EM_a and X550EM_x.
This makes it easier to assign function pointers with specific
dependencies (like media type) for each MAC.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_api.c  |  4 +-
 drivers/net/ixgbe/base/ixgbe_api.h  |  2 +
 drivers/net/ixgbe/base/ixgbe_x550.c | 83 ++++++++++++++++++++++++++-----------
 3 files changed, 64 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ixgbe/base/ixgbe_api.c b/drivers/net/ixgbe/base/ixgbe_api.c
index 1786867..12ba093 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.c
+++ b/drivers/net/ixgbe/base/ixgbe_api.c
@@ -106,8 +106,10 @@ s32 ixgbe_init_shared_code(struct ixgbe_hw *hw)
 		status = ixgbe_init_ops_X550(hw);
 		break;
 	case ixgbe_mac_X550EM_x:
+		status = ixgbe_init_ops_X550EM_x(hw);
+		break;
 	case ixgbe_mac_X550EM_a:
-		status = ixgbe_init_ops_X550EM(hw);
+		status = ixgbe_init_ops_X550EM_a(hw);
 		break;
 	case ixgbe_mac_82599_vf:
 	case ixgbe_mac_X540_vf:
diff --git a/drivers/net/ixgbe/base/ixgbe_api.h b/drivers/net/ixgbe/base/ixgbe_api.h
index 3aad1da..24c4ae8 100644
--- a/drivers/net/ixgbe/base/ixgbe_api.h
+++ b/drivers/net/ixgbe/base/ixgbe_api.h
@@ -45,6 +45,8 @@ extern s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_X540(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw);
+extern s32 ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw);
+extern s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw);
 extern s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);
 
 s32 ixgbe_set_mac_type(struct ixgbe_hw *hw);
diff --git a/drivers/net/ixgbe/base/ixgbe_x550.c b/drivers/net/ixgbe/base/ixgbe_x550.c
index 5c09bfe..db12339 100644
--- a/drivers/net/ixgbe/base/ixgbe_x550.c
+++ b/drivers/net/ixgbe/base/ixgbe_x550.c
@@ -604,7 +604,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 	struct ixgbe_mac_info *mac = &hw->mac;
 	struct ixgbe_eeprom_info *eeprom = &hw->eeprom;
 	struct ixgbe_phy_info *phy = &hw->phy;
-	struct ixgbe_link_info *link = &hw->link;
 	s32 ret_val;
 
 	DEBUGFUNC("ixgbe_init_ops_X550EM");
@@ -640,25 +639,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 	hw->bus.type = ixgbe_bus_type_internal;
 	mac->ops.get_bus_info = ixgbe_get_bus_info_X550em;
 
-	if (hw->mac.type == ixgbe_mac_X550EM_x) {
-		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
-		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
-		mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550em;
-		mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550em;
-		link->ops.read_link = ixgbe_read_i2c_combined_generic;
-		link->ops.read_link_unlocked =
-				ixgbe_read_i2c_combined_generic_unlocked;
-		link->ops.write_link = ixgbe_write_i2c_combined_generic;
-		link->ops.write_link_unlocked =
-				ixgbe_write_i2c_combined_generic_unlocked;
-		link->addr = IXGBE_CS4227;
-	}
-	if (hw->mac.type == ixgbe_mac_X550EM_a) {
-		mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
-		mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
-		mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
-		mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
-	}
 
 	mac->ops.get_media_type = ixgbe_get_media_type_X550em;
 	mac->ops.setup_sfp = ixgbe_setup_sfp_modules_X550em;
@@ -669,10 +649,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 
 	if (mac->ops.get_media_type(hw) == ixgbe_media_type_copper)
 		mac->ops.setup_fc = ixgbe_setup_fc_generic;
-	else if (hw->mac.type == ixgbe_mac_X550EM_a) {
-		mac->ops.setup_fc = ixgbe_setup_fc_x550a;
-		mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
-	}
 	else
 		mac->ops.setup_fc = ixgbe_setup_fc_X550em;
 
@@ -706,6 +682,65 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_hw *hw)
 }
 
 /**
+*  ixgbe_init_ops_X550EM_a - Inits func ptrs and MAC type
+*  @hw: pointer to hardware structure
+*
+*  Initialize the function pointers and for MAC type X550EM_a.
+*  Does not touch the hardware.
+**/
+s32 ixgbe_init_ops_X550EM_a(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	s32 ret_val;
+
+	DEBUGFUNC("ixgbe_init_ops_X550EM_a");
+
+	/* Start with generic X550EM init */
+	ret_val = ixgbe_init_ops_X550EM(hw);
+
+	mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
+	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550a;
+	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550a;
+	mac->ops.setup_fc = ixgbe_setup_fc_x550a;
+	mac->ops.fc_autoneg = ixgbe_fc_autoneg_x550a;
+
+	return ret_val;
+}
+
+/**
+*  ixgbe_init_ops_X550EM_x - Inits func ptrs and MAC type
+*  @hw: pointer to hardware structure
+*
+*  Initialize the function pointers and for MAC type X550EM_x.
+*  Does not touch the hardware.
+**/
+s32 ixgbe_init_ops_X550EM_x(struct ixgbe_hw *hw)
+{
+	struct ixgbe_mac_info *mac = &hw->mac;
+	struct ixgbe_link_info *link = &hw->link;
+	s32 ret_val;
+
+	DEBUGFUNC("ixgbe_init_ops_X550EM_x");
+
+	/* Start with generic X550EM init */
+	ret_val = ixgbe_init_ops_X550EM(hw);
+
+	mac->ops.read_iosf_sb_reg = ixgbe_read_iosf_sb_reg_x550;
+	mac->ops.write_iosf_sb_reg = ixgbe_write_iosf_sb_reg_x550;
+	mac->ops.acquire_swfw_sync = ixgbe_acquire_swfw_sync_X550em;
+	mac->ops.release_swfw_sync = ixgbe_release_swfw_sync_X550em;
+	link->ops.read_link = ixgbe_read_i2c_combined_generic;
+	link->ops.read_link_unlocked = ixgbe_read_i2c_combined_generic_unlocked;
+	link->ops.write_link = ixgbe_write_i2c_combined_generic;
+	link->ops.write_link_unlocked =
+				      ixgbe_write_i2c_combined_generic_unlocked;
+	link->addr = IXGBE_CS4227;
+
+	return ret_val;
+}
+
+/**
  *  ixgbe_dmac_config_X550
  *  @hw: pointer to hardware structure
  *
-- 
1.9.3

  parent reply	other threads:[~2016-09-25  9:00 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-27 15:47 [dpdk-dev] [PATCH 00/39] net/ixgbe: base code update Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 01/39] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
2016-09-19 17:00   ` Ferruh Yigit
2016-09-22 15:58     ` Wang, Xiao W
2016-09-25  8:59   ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 01/40] net/ixgbe/base: fix delta check for setting VFTA Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 02/40] net/ixgbe/base: remove X550em SFP iXFI setup Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 03/40] net/ixgbe/base: change endianness of PHY data Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 04/40] net/ixgbe/base: add X550em_a 10G PHY support Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 05/40] net/ixgbe/base: move vf_update_xcast_mode to base code Xiao Wang
2016-09-25  8:59     ` Xiao Wang [this message]
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 07/40] net/ixgbe/base: separate PHY probe code Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 08/40] net/ixgbe/base: fully initialize X550em_a 1G PHYs Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 09/40] net/ixgbe/base: add macros for VF promiscuous mode Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 10/40] net/ixgbe/base: add FC setup for X550em_a fiber Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 11/40] net/ixgbe/base: add FC autoneg " Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 12/40] net/ixgbe/base: clear page register in error path Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 13/40] net/ixgbe/base: configure DMAC for 10Mb operation Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 14/40] net/ixgbe/base: fix function comments about X550 Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 15/40] net/ixgbe/base: report setting LPE register error Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 16/40] net/ixgbe/base: bump mailbox version Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 17/40] net/ixgbe/base: access IOSF by host interface Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 18/40] net/ixgbe/base: fix check on NACK Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 19/40] net/ixgbe/base: define X550 PCIe serial MAC addr Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 20/40] net/ixgbe/base: bypass checking link for crosstalk Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 21/40] net/ixgbe/base: support X550em_a SGMII FC autoneg Xiao Wang
2016-09-25  8:59     ` [dpdk-dev] [PATCH v2 22/40] net/ixgbe/base: add macros for GENEVE UDP port Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 23/40] net/ixgbe/base: add bound check in LED functions Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 24/40] net/ixgbe/base: use default check link function Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 25/40] net/ixgbe/base: set default autoneg speed at reset Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 26/40] net/ixgbe/base: add missing FDIRSCTPM mask setting Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 27/40] net/ixgbe/base: commonize mailbox write and read Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 28/40] net/ixgbe/base: reduce delay for SWFW semaphore Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 29/40] net/ixgbe/base: report autoneg supported for X550 Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 30/40] net/ixgbe/base: remove X550em_a 100Mbps support Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 31/40] net/ixgbe/base: unify link speed value Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 32/40] net/ixgbe/base: separate ops init from PHY init Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 33/40] net/ixgbe/base: add X550em_a FW ALEF support Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 34/40] net/ixgbe/base: add two MAC ops for Hyper-V Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 35/40] net/ixgbe/base: hold semaphore for shadow RAM access Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 36/40] net/ixgbe/base: update X550em_a backplane speed Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 37/40] net/ixgbe/base: clean code of flow control autoneg Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 38/40] net/ixgbe/base: do not skip PHY configuration Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 39/40] net/ixgbe/base: clean up Xiao Wang
2016-09-25  9:00     ` [dpdk-dev] [PATCH v2 40/40] net/ixgbe/base: add base driver update brief Xiao Wang
2016-09-26  2:06     ` [dpdk-dev] [PATCH v2 00/40] net/ixgbe: base code update Lu, Wenzhuo
2016-09-28 15:31       ` Bruce Richardson
2016-08-27 15:47 ` [dpdk-dev] [PATCH 02/39] net/ixgbe/base: remove X550em SFP iXFI setup Xiao Wang
2016-09-19 17:01   ` Ferruh Yigit
2016-08-27 15:47 ` [dpdk-dev] [PATCH 03/39] net/ixgbe/base: change endianness of PHY data Xiao Wang
2016-09-19 17:01   ` Ferruh Yigit
2016-09-25  0:36     ` Wang, Xiao W
2016-08-27 15:47 ` [dpdk-dev] [PATCH 04/39] net/ixgbe/base: add X550em_a 10G PHY support Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 05/39] net/ixgbe/base: support VF multicast promiscuous Xiao Wang
2016-09-19 17:05   ` Ferruh Yigit
2016-09-23  3:35     ` Wang, Xiao W
2016-08-27 15:47 ` [dpdk-dev] [PATCH 06/39] net/ixgbe/base: introduce new ops init functions Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 07/39] net/ixgbe/base: separate PHY probe code Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 08/39] net/ixgbe/base: fully initialize X550em_a 1G PHYs Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 09/39] net/ixgbe/base: add macros for VF promiscuous mode Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 10/39] net/ixgbe/base: add FC setup for X550em_a fiber Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 11/39] net/ixgbe/base: add FC autoneg " Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 12/39] net/ixgbe/base: clear page register in error path Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 13/39] net/ixgbe/base: configure DMAC for 10Mb operation Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 14/39] net/ixgbe/base: fix function comments about X550 Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 15/39] net/ixgbe/base: report setting LPE register error Xiao Wang
2016-08-27 15:47 ` [dpdk-dev] [PATCH 16/39] net/ixgbe/base: bump mailbox version Xiao Wang
2016-09-19 17:03   ` Ferruh Yigit
2016-09-23  3:50     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 17/39] net/ixgbe/base: access IOSF by host interface Xiao Wang
2016-09-19 17:04   ` Ferruh Yigit
2016-09-23  5:16     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 18/39] net/ixgbe/base: fix check on NACK Xiao Wang
2016-09-19 17:07   ` Ferruh Yigit
2016-09-23  6:05     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 19/39] net/ixgbe/base: define X550 PCIe serial MAC addr Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 20/39] net/ixgbe/base: bypass checking link for crosstalk Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 21/39] net/ixgbe/base: support X550em_a SGMII FC autoneg Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 22/39] net/ixgbe/base: add macros for GENEVE UDP port Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions Xiao Wang
2016-09-19 17:06   ` Ferruh Yigit
2016-09-22 16:08     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 24/39] net/ixgbe/base: use default check link function Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 25/39] net/ixgbe/base: set default autoneg speed at reset Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 26/39] net/ixgbe/base: add missing FDIRSCTPM mask setting Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 27/39] net/ixgbe/base: commonize mailbox write and read Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 28/39] net/ixgbe/base: reduce delay for SWFW semaphore Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 29/39] net/ixgbe/base: report autoneg supported for X550 Xiao Wang
2016-09-19 17:07   ` Ferruh Yigit
2016-09-23  0:59     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 30/39] net/ixgbe/base: remove X550em_a 100Mbps support Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 31/39] net/ixgbe/base: unify link speed value Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 32/39] net/ixgbe/base: separate ops init from PHY init Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 33/39] net/ixgbe/base: add X550em_a FW ALEF support Xiao Wang
2016-09-19 17:07   ` Ferruh Yigit
2016-09-22  2:56     ` Lu, Wenzhuo
2016-09-23  6:47       ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 34/39] net/ixgbe/base: add two MAC ops for Hyper-V Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 35/39] net/ixgbe/base: hold semaphore for shadow RAM access Xiao Wang
2016-09-19 17:08   ` Ferruh Yigit
2016-09-23  8:06     ` Wang, Xiao W
2016-08-27 15:48 ` [dpdk-dev] [PATCH 36/39] net/ixgbe/base: update X550em_a backplane speed Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 37/39] net/ixgbe/base: clean code of flow control autoneg Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 38/39] net/ixgbe/base: do not skip PHY configuration Xiao Wang
2016-08-27 15:48 ` [dpdk-dev] [PATCH 39/39] net/ixgbe/base: add base driver update brief Xiao Wang
2016-09-19 17:08   ` Ferruh Yigit
2016-09-22  2:55     ` Lu, Wenzhuo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1474794017-5896-7-git-send-email-xiao.w.wang@intel.com \
    --to=xiao.w.wang@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).