Skip to contentSkip to conversation

cxgb4/cxgb4vf: VF link state support

PATCH In review Arjun Vynipadath 2 participants 4 messages Mar 1, 2019 – Mar 2, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover cxgb4/cxgb4vf: VF link state support

This series of patches adds support for ndo_set_vf_link_state in cxgb4 driver.

Patch 1 implements ndo_set_vf_link_state
Patch 2 reverts the existing force_link_up behaviour for cxgb4vf driver.

v2:
- Using reverse christmas tree for variable declaration in Patch 1
- Patch 2 has no change

Arjun Vynipadath (2):
cxgb4: Add VF Link state support
cxgb4vf: Revert force link up behaviour

 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h         |  1 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c    | 57 +++++++++++++++++++---
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h      | 10 ++++
 .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c    | 13 ++---
 4 files changed, 65 insertions(+), 16 deletions(-)
Signature · 1 line
2.9.5
#1 lore raw

PATCH v2 1/2 cxgb4: Add VF Link state support

Use ndo_set_vf_link_state to control the link states associated with the virtual interfaces.

---
v2:
- Using reverse christmas tree for variable declaration
- Renamed FW_LINK* macros for vf link states to make it more clean.

---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h      |  1 +
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 57 ++++++++++++++++++++++---
 drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h   |  8 ++++
 3 files changed, 60 insertions(+), 6 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +1 -0
index b7b0eb104430..dd6379809c74 100644
@@ -885,6 +885,7 @@ struct vf_info {
 	unsigned int tx_rate;
 	bool pf_set_mac;
 	u16 vlan;
+	int link_state;
 };
 
 enum {
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +51 -6

75 lines not on this page · raw message

drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +8 -0
index 631f1663f4e0..b2a618e72fcf 100644
@@ -1312,6 +1312,14 @@ enum fw_params_param_pfvf {
 	FW_PARAMS_PARAM_PFVF_RAWF_END = 0x37,
 	FW_PARAMS_PARAM_PFVF_NCRYPTO_LOOKASIDE = 0x39,
 	FW_PARAMS_PARAM_PFVF_PORT_CAPS32 = 0x3A,
+	FW_PARAMS_PARAM_PFVF_LINK_STATE = 0x40,
+};
+
+/* Virtual link state as seen by the specified VF */
+enum vf_link_states {
+	FW_VF_LINK_STATE_AUTO		= 0x00,
+	FW_VF_LINK_STATE_ENABLE		= 0x01,
+	FW_VF_LINK_STATE_DISABLE	= 0x02,
 };
 
 /*
Signature · 1 line
2.9.5
#2 lore raw

PATCH v2 2/2 cxgb4vf: Revert force link up behaviour

In reply to Arjun Vynipadath

Reverting force link up changes since this behaviour can be achieved using VF link state feature.

Reverts:
commit 0913667ab3ad ("cxgb4vf: Forcefully link up virtual interfaces")

---
v2:
- No changes

---
 drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +3 -10
index 3300b69a42b3..ed888227d81d 100644
@@ -155,6 +155,8 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)
 		const char *fc;
 		const struct port_info *pi = netdev_priv(dev);
 
+		netif_carrier_on(dev);
+
 		switch (pi->link_cfg.speed) {
 		case 100:
 			s = "100Mbps";
@@ -200,6 +202,7 @@ void t4vf_os_link_changed(struct adapter *adapter, int pidx, int link_ok)
 
 		netdev_info(dev, "link up, %s, full-duplex, %s PAUSE\n", s, fc);
 	} else {
+		netif_carrier_off(dev);
 		netdev_info(dev, "link down\n");
 	}
 }
@@ -339,16 +342,6 @@ static int link_start(struct net_device *dev)
 	if (ret == 0)
 		ret = t4vf_enable_pi(pi->adapter, pi, true, true);
 
-	/* The Virtual Interfaces are connected to an internal switch on the
-	 * chip which allows VIs attached to the same port to talk to each
-	 * other even when the port link is down.  As a result, we generally
-	 * want to always report a VI's link as being "up", provided there are
-	 * no errors in enabling vi.
-	 */
-
-	if (ret == 0)
-		netif_carrier_on(dev);
-
 	return ret;
 }
 
Signature · 1 line
2.9.5
maintainer
#3 lore raw
In reply to Arjun Vynipadath

From: Arjun Vynipadath <[email protected]>
Date: Fri, 1 Mar 2019 15:44:46 +0530

Quoted 9 lines

This series of patches adds support for ndo_set_vf_link_state in cxgb4 driver.

Patch 1 implements ndo_set_vf_link_state
Patch 2 reverts the existing force_link_up behaviour for cxgb4vf driver.

v2:
- Using reverse christmas tree for variable declaration in Patch 1
- Patch 2 has no change

Series applied.