All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] net/i40e: enable 25G device
@ 2016-09-11 19:43 Zhang Qi
  2016-09-11 19:43 ` [PATCH 1/2] net/i40e: add func to check link speed Zhang Qi
  2016-09-11 19:43 ` [PATCH 2/2] net/i40e: enable 25G device Zhang Qi
  0 siblings, 2 replies; 4+ messages in thread
From: Zhang Qi @ 2016-09-11 19:43 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Zhang Qi

The patch enable devices that support 25G link speed.
It is based on previous 25G base driver update:
http://dpdk.org/ml/archives/dev/2016-August/045569.html


Zhang Qi (2):
  net/i40e: add func to check link speed
  net/i40e: enable 25G device

 drivers/net/i40e/i40e_ethdev.c | 40 +++++++++++++++++++++++++++++-----------
 drivers/net/i40e/i40e_ethdev.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 11 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] net/i40e: add func to check link speed
  2016-09-11 19:43 [PATCH 0/2] net/i40e: enable 25G device Zhang Qi
@ 2016-09-11 19:43 ` Zhang Qi
  2016-09-12  3:00   ` Yuanhan Liu
  2016-09-11 19:43 ` [PATCH 2/2] net/i40e: enable 25G device Zhang Qi
  1 sibling, 1 reply; 4+ messages in thread
From: Zhang Qi @ 2016-09-11 19:43 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Zhang Qi

Add a help function to check link speed by device ID.
Replace macro "i40e_is_40G_device" with the new function.

Signed-off-by: Zhang Qi <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 19 ++++++++++++-------
 drivers/net/i40e/i40e_ethdev.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 7 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index acc25a2..fc7e128 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1642,7 +1642,7 @@ i40e_apply_link_speed(struct rte_eth_dev *dev)
 	uint8_t abilities = 0;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
-
+	enum i40e_aq_link_speed link_speed = i40e_get_link_speed_by_devid(hw->device_id);
 	speed = i40e_parse_link_speeds(conf->link_speeds);
 	abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
 	if (!(conf->link_speeds & ETH_LINK_SPEED_FIXED))
@@ -1650,7 +1650,7 @@ i40e_apply_link_speed(struct rte_eth_dev *dev)
 	abilities |= I40E_AQ_PHY_LINK_ENABLED;
 
 	/* Skip changing speed on 40G interfaces, FW does not support */
-	if (i40e_is_40G_device(hw->device_id)) {
+	if (link_speed == I40E_LINK_SPEED_40GB) {
 		speed =  I40E_LINK_SPEED_UNKNOWN;
 		abilities |= I40E_AQ_PHY_AN_ENABLED;
 	}
@@ -2554,6 +2554,7 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_vsi *vsi = pf->main_vsi;
+	enum i40e_aq_link_speed link_speed = I40E_LINK_SPEED_UNKNOWN;
 
 	dev_info->max_rx_queues = vsi->nb_qps;
 	dev_info->max_tx_queues = vsi->nb_qps;
@@ -2624,8 +2625,9 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 		dev_info->max_rx_queues += dev_info->vmdq_queue_num;
 		dev_info->max_tx_queues += dev_info->vmdq_queue_num;
 	}
-
-	if (i40e_is_40G_device(hw->device_id))
+	
+	link_speed = i40e_get_link_speed_by_devid(hw->device_id);
+	if (link_speed == I40E_LINK_SPEED_40GB)
 		/* For XL710 */
 		dev_info->speed_capa = ETH_LINK_SPEED_40G;
 	else
@@ -2845,6 +2847,7 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 		[RTE_FC_TX_PAUSE] = I40E_FC_TX_PAUSE,
 		[RTE_FC_FULL] = I40E_FC_FULL
 	};
+	enum i40e_aq_link_speed link_speed = I40E_LINK_SPEED_UNKNOWN;
 
 	/* high_water field in the rte_eth_fc_conf using the kilobytes unit */
 
@@ -2872,8 +2875,9 @@ i40e_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 	err = i40e_set_fc(hw, &aq_failure, true);
 	if (err < 0)
 		return -ENOSYS;
-
-	if (i40e_is_40G_device(hw->device_id)) {
+	
+	link_speed = i40e_get_link_speed_by_devid(hw->device_id);
+	if (link_speed == I40E_LINK_SPEED_40GB) {
 		/* Configure flow control refresh threshold,
 		 * the value for stat_tx_pause_refresh_timer[8]
 		 * is used for global pause operation.
@@ -8069,10 +8073,11 @@ i40e_configure_registers(struct i40e_hw *hw)
 	uint64_t reg;
 	uint32_t i;
 	int ret;
+	enum i40e_aq_link_speed link_speed = i40e_get_link_speed_by_devid(hw->device_id);
 
 	for (i = 0; i < RTE_DIM(reg_table); i++) {
 		if (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR) {
-			if (i40e_is_40G_device(hw->device_id)) /* For XL710 */
+			if (link_speed == I40E_LINK_SPEED_40GB) /* For XL710 */
 				reg_table[i].val =
 					I40E_GL_SWR_PM_UP_THR_SF_VALUE;
 			else /* For X710 */
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index 92c8fad..633bcdf 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -712,4 +712,46 @@ i40e_calc_itr_interval(int16_t interval)
 	(pctype) == I40E_FILTER_PCTYPE_NONF_IPV6_OTHER || \
 	(pctype) == I40E_FILTER_PCTYPE_L2_PAYLOAD)
 
+static inline enum i40e_aq_link_speed
+i40e_get_link_speed_by_devid(u16 dev_id)
+{
+	switch (dev_id) {
+	case I40E_DEV_ID_10G_BASE_T:
+	case I40E_DEV_ID_10G_BASE_T4:
+#ifdef X722_SUPPORT
+#ifdef X722_A0_SUPPORT
+	case I40E_DEV_ID_X722_A0:
+#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
+	case I40E_DEV_ID_X722_A0_VF:
+#endif
+#endif
+	case I40E_DEV_ID_KX_X722:
+	case I40E_DEV_ID_QSFP_X722:
+	case I40E_DEV_ID_SFP_X722:
+	case I40E_DEV_ID_1G_BASE_T_X722:
+	case I40E_DEV_ID_10G_BASE_T_X722:
+	case I40E_DEV_ID_SFP_I_X722:
+#define I40E_DEV_ID_QSFP_I_X722		0x37D4
+#if defined(INTEGRATED_VF) || defined(VF_DRIVER) || defined(I40E_NDIS_SUPPORT)
+	case I40E_DEV_ID_X722_VF:
+	case I40E_DEV_ID_X722_VF_HV:
+#endif
+#endif
+		return I40E_LINK_SPEED_10GB;
+	case I40E_DEV_ID_20G_KR2:
+	case I40E_DEV_ID_20G_KR2_A:
+		return I40E_LINK_SPEED_20GB;
+	case I40E_DEV_ID_25G_B:
+	case I40E_DEV_ID_25G_SFP28:
+		return I40E_LINK_SPEED_25GB;
+	case I40E_DEV_ID_QSFP_A:
+	case I40E_DEV_ID_QSFP_B:
+	case I40E_DEV_ID_QSFP_C:
+		return I40E_LINK_SPEED_40GB;
+	default:
+		return I40E_LINK_SPEED_UNKNOWN;
+	}	
+}
+
+
 #endif /* _I40E_ETHDEV_H_ */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] net/i40e: enable 25G device
  2016-09-11 19:43 [PATCH 0/2] net/i40e: enable 25G device Zhang Qi
  2016-09-11 19:43 ` [PATCH 1/2] net/i40e: add func to check link speed Zhang Qi
@ 2016-09-11 19:43 ` Zhang Qi
  1 sibling, 0 replies; 4+ messages in thread
From: Zhang Qi @ 2016-09-11 19:43 UTC (permalink / raw)
  To: jingjing.wu, helin.zhang; +Cc: dev, Zhang Qi

Add code branch for 25G link speed,
so 25G device will be functional.

Signed-off-by: Zhang Qi <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index fc7e128..e5b6554 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1567,6 +1567,8 @@ i40e_parse_link_speeds(uint16_t link_speeds)
 
 	if (link_speeds & ETH_LINK_SPEED_40G)
 		link_speed |= I40E_LINK_SPEED_40GB;
+	if (link_speeds & ETH_LINK_SPEED_25G)
+		link_speed |= I40E_LINK_SPEED_25GB;
 	if (link_speeds & ETH_LINK_SPEED_20G)
 		link_speed |= I40E_LINK_SPEED_20GB;
 	if (link_speeds & ETH_LINK_SPEED_10G)
@@ -1592,6 +1594,7 @@ i40e_phy_conf_link(struct i40e_hw *hw,
 			I40E_AQ_PHY_FLAG_PAUSE_RX |
 			I40E_AQ_PHY_FLAG_LOW_POWER;
 	const uint8_t advt = I40E_LINK_SPEED_40GB |
+			I40E_LINK_SPEED_25GB |
 			I40E_LINK_SPEED_10GB |
 			I40E_LINK_SPEED_1GB |
 			I40E_LINK_SPEED_100MB;
@@ -1644,7 +1647,8 @@ i40e_apply_link_speed(struct rte_eth_dev *dev)
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
 	enum i40e_aq_link_speed link_speed = i40e_get_link_speed_by_devid(hw->device_id);
 	speed = i40e_parse_link_speeds(conf->link_speeds);
-	abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
+	if (link_speed != I40E_LINK_SPEED_25GB)
+		abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
 	if (!(conf->link_speeds & ETH_LINK_SPEED_FIXED))
 		abilities |= I40E_AQ_PHY_AN_ENABLED;
 	abilities |= I40E_AQ_PHY_LINK_ENABLED;
@@ -1746,7 +1750,8 @@ i40e_dev_start(struct rte_eth_dev *dev)
 	/* Apply link configure */
 	if (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M |
 				ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G |
-				ETH_LINK_SPEED_20G | ETH_LINK_SPEED_40G)) {
+				ETH_LINK_SPEED_20G | ETH_LINK_SPEED_25G |
+				ETH_LINK_SPEED_40G)) {
 		PMD_DRV_LOG(ERR, "Invalid link setting");
 		goto err_up;
 	}
@@ -1966,9 +1971,10 @@ static int
 i40e_dev_set_link_down(struct rte_eth_dev *dev)
 {
 	uint8_t speed = I40E_LINK_SPEED_UNKNOWN;
-	uint8_t abilities = I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
+	uint8_t abilities = 0;
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-
+	if (i40e_get_link_speed_by_devid(hw->device_id)!=I40E_LINK_SPEED_25GB)
+		abilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;
 	return i40e_phy_conf_link(hw, abilities, speed);
 }
 
@@ -2026,6 +2032,9 @@ i40e_dev_link_update(struct rte_eth_dev *dev,
 	case I40E_LINK_SPEED_20GB:
 		link.link_speed = ETH_SPEED_NUM_20G;
 		break;
+	case I40E_LINK_SPEED_25GB:
+		link.link_speed = ETH_SPEED_NUM_25G;
+		break;
 	case I40E_LINK_SPEED_40GB:
 		link.link_speed = ETH_SPEED_NUM_40G;
 		break;
@@ -2630,6 +2639,9 @@ i40e_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	if (link_speed == I40E_LINK_SPEED_40GB)
 		/* For XL710 */
 		dev_info->speed_capa = ETH_LINK_SPEED_40G;
+	if (link_speed == I40E_LINK_SPEED_25GB)
+		/* For XXL710 */
+		dev_info->speed_capa = ETH_LINK_SPEED_25G;
 	else
 		/* For X710 */
 		dev_info->speed_capa = ETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G;
@@ -8077,7 +8089,8 @@ i40e_configure_registers(struct i40e_hw *hw)
 
 	for (i = 0; i < RTE_DIM(reg_table); i++) {
 		if (reg_table[i].addr == I40E_GL_SWR_PM_UP_THR) {
-			if (link_speed == I40E_LINK_SPEED_40GB) /* For XL710 */
+			if (link_speed == I40E_LINK_SPEED_40GB ||
+			    link_speed == I40E_LINK_SPEED_25GB) /* For XL710 */
 				reg_table[i].val =
 					I40E_GL_SWR_PM_UP_THR_SF_VALUE;
 			else /* For X710 */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] net/i40e: add func to check link speed
  2016-09-11 19:43 ` [PATCH 1/2] net/i40e: add func to check link speed Zhang Qi
@ 2016-09-12  3:00   ` Yuanhan Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Yuanhan Liu @ 2016-09-12  3:00 UTC (permalink / raw)
  To: Zhang Qi; +Cc: jingjing.wu, helin.zhang, dev

On Mon, Sep 12, 2016 at 03:43:53AM +0800, Zhang Qi wrote:
> Add a help function to check link speed by device ID.
> Replace macro "i40e_is_40G_device" with the new function.
> 
> Signed-off-by: Zhang Qi <qi.z.zhang@intel.com>

Hi,

FYI, my testrobot caught some warnings whlie applying this patch

	--yliu

---
Applying: net/i40e: add func to check link speed
.git/rebase-apply/patch:42: trailing whitespace.

.git/rebase-apply/patch:62: trailing whitespace.

.git/rebase-apply/patch:127: trailing whitespace.
        }
warning: 3 lines add whitespace errors.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-12  3:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-11 19:43 [PATCH 0/2] net/i40e: enable 25G device Zhang Qi
2016-09-11 19:43 ` [PATCH 1/2] net/i40e: add func to check link speed Zhang Qi
2016-09-12  3:00   ` Yuanhan Liu
2016-09-11 19:43 ` [PATCH 2/2] net/i40e: enable 25G device Zhang Qi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.