Skip to contentSkip to conversation

ionic: VF attr replay and other updates

PATCH Superseded Shannon Nelson 3 participants 10 messages Oct 24, 2022 – Oct 25, 2022

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover ionic: VF attr replay and other updates

For better VF management when a FW update restart or a FW crash recover is detected, the PF now will replay any user specified VF attributes to be sure the FW hasn't lost them in the restart.

Newer FW offers more packet processing offloads, so we now support them in the driver.

A small refactor of the Rx buffer fill cleans a bit of code and will help future work on buffer caching.

Neel Patel (2):
ionic: enable tunnel offloads
ionic: refactor use of ionic_rx_fill()

Shannon Nelson (3):
ionic: replay VF attributes after fw crash recovery
ionic: only save the user set VF attributes
ionic: new ionic device identity level and VF start control

 .../net/ethernet/pensando/ionic/ionic_dev.c   |  20 ++++
 .../net/ethernet/pensando/ionic/ionic_dev.h   |   3 +
 .../net/ethernet/pensando/ionic/ionic_if.h    |  41 +++++++
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 113 +++++++++++++++---
 .../net/ethernet/pensando/ionic/ionic_main.c  |   2 +-
 .../net/ethernet/pensando/ionic/ionic_txrx.c  |  31 +++--
 6 files changed, 179 insertions(+), 31 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/5 ionic: replay VF attributes after fw crash recovery

The VF attributes that the user has set into the FW through the PF can be lost over a FW crash recovery. Much like we already replay the PF mac/vlan filters, we now add a replay in the recovery path to be sure the FW has the up-to-date VF configurations.

---
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +70 -0
index 19d4848df17d..5d593198ad72 100644
@@ -2562,6 +2562,74 @@ static int ionic_set_vf_link_state(struct net_device *netdev, int vf, int set)
 	return ret;
 }
 
+static void ionic_vf_attr_replay(struct ionic_lif *lif)
+{
+	struct ionic_vf_setattr_cmd vfc = { 0 };
+	struct ionic *ionic = lif->ionic;
+	struct ionic_vf *v;
+	int i;
+
+	if (!ionic->vfs)
+		return;
+
+	down_read(&ionic->vf_op_lock);
+
+	for (i = 0; i < ionic->num_vfs; i++) {
+		v = &ionic->vfs[i];
+
+		if (v->stats_pa) {
+			vfc.attr = IONIC_VF_ATTR_STATSADDR;
+			vfc.stats_pa = cpu_to_le64(v->stats_pa);
+			(void)ionic_set_vf_config(ionic, i, &vfc);
+			vfc.stats_pa = 0;
+		}
+
+		if (!is_zero_ether_addr(v->macaddr)) {
+			vfc.attr = IONIC_VF_ATTR_MAC;
+			ether_addr_copy(vfc.macaddr, v->macaddr);
+			(void)ionic_set_vf_config(ionic, i, &vfc);
+			eth_zero_addr(vfc.macaddr);
+		}
+
+		if (v->vlanid) {
+			vfc.attr = IONIC_VF_ATTR_VLAN;
+			vfc.vlanid = v->vlanid;
+			(void)ionic_set_vf_config(ionic, i, &vfc);
+			vfc.vlanid = 0;
+		}
+
+		if (v->maxrate) {
+			vfc.attr = IONIC_VF_ATTR_RATE;
+			vfc.maxrate = v->maxrate;
+			(void)ionic_set_vf_config(ionic, i, &vfc);
+			vfc.maxrate = 0;
+		}
+
+		if (v->spoofchk) {
+			vfc.attr = IONIC_VF_ATTR_SPOOFCHK;
+			vfc.spoofchk = v->spoofchk;
+			(void)ionic_set_vf_config(ionic, i, &vfc);
+			vfc.spoofchk = 0;
+		}
+
+		if (v->trusted) {
+			vfc.attr = IONIC_VF_ATTR_TRUST;
+			vfc.trust = v->trusted;
+			(void)ionic_set_vf_config(ionic, i, &vfc);
+			vfc.trust = 0;
+		}
+
+		if (v->linkstate) {
+			vfc.attr = IONIC_VF_ATTR_LINKSTATE;
+			vfc.linkstate = v->linkstate;
+			(void)ionic_set_vf_config(ionic, i, &vfc);
+			vfc.linkstate = 0;
+		}
+	}
+
+	up_read(&ionic->vf_op_lock);
+}
+
 static const struct net_device_ops ionic_netdev_ops = {
 	.ndo_open               = ionic_open,
 	.ndo_stop               = ionic_stop,
@@ -3042,6 +3110,8 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
 	if (err)
 		goto err_qcqs_free;
 
+	ionic_vf_attr_replay(lif);
+
 	if (lif->registered)
 		ionic_lif_set_netdev_info(lif);
 
Signature · 1 line
2.17.1
#4 lore raw

PATCH 2/5 ionic: only save the user set VF attributes

In reply to Shannon Nelson

Report the current FW values for the VF attributes, but don't save the FW values locally, only save the vf attributes that are given to us from the user. This allows us to replay user data, and doesn't end up confusing things like "who set the mac address".

---
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 33 ++++++++++---------
 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +17 -16
index 5d593198ad72..39a2e693e715 100644
@@ -2220,7 +2220,7 @@ static int ionic_eth_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd
 	}
 }
 
-static int ionic_update_cached_vf_config(struct ionic *ionic, int vf)
+static int ionic_get_fw_vf_config(struct ionic *ionic, int vf, struct ionic_vf *vfdata)
 {
 	struct ionic_vf_getattr_comp comp = { 0 };
 	int err;
@@ -2231,14 +2231,14 @@ static int ionic_update_cached_vf_config(struct ionic *ionic, int vf)
 	if (err && comp.status != IONIC_RC_ENOSUPP)
 		goto err_out;
 	if (!err)
-		ionic->vfs[vf].vlanid = comp.vlanid;
+		vfdata->vlanid = comp.vlanid;
 
 	attr = IONIC_VF_ATTR_SPOOFCHK;
 	err = ionic_dev_cmd_vf_getattr(ionic, vf, attr, &comp);
 	if (err && comp.status != IONIC_RC_ENOSUPP)
 		goto err_out;
 	if (!err)
-		ionic->vfs[vf].spoofchk = comp.spoofchk;
+		vfdata->spoofchk = comp.spoofchk;
 
 	attr = IONIC_VF_ATTR_LINKSTATE;
 	err = ionic_dev_cmd_vf_getattr(ionic, vf, attr, &comp);
@@ -2247,13 +2247,13 @@ static int ionic_update_cached_vf_config(struct ionic *ionic, int vf)
 	if (!err) {
 		switch (comp.linkstate) {
 		case IONIC_VF_LINK_STATUS_UP:
-			ionic->vfs[vf].linkstate = IFLA_VF_LINK_STATE_ENABLE;
+			vfdata->linkstate = IFLA_VF_LINK_STATE_ENABLE;
 			break;
 		case IONIC_VF_LINK_STATUS_DOWN:
-			ionic->vfs[vf].linkstate = IFLA_VF_LINK_STATE_DISABLE;
+			vfdata->linkstate = IFLA_VF_LINK_STATE_DISABLE;
 			break;
 		case IONIC_VF_LINK_STATUS_AUTO:
-			ionic->vfs[vf].linkstate = IFLA_VF_LINK_STATE_AUTO;
+			vfdata->linkstate = IFLA_VF_LINK_STATE_AUTO;
 			break;
 		default:
 			dev_warn(ionic->dev, "Unexpected link state %u\n", comp.linkstate);
@@ -2266,21 +2266,21 @@ static int ionic_update_cached_vf_config(struct ionic *ionic, int vf)
 	if (err && comp.status != IONIC_RC_ENOSUPP)
 		goto err_out;
 	if (!err)
-		ionic->vfs[vf].maxrate = comp.maxrate;
+		vfdata->maxrate = comp.maxrate;
 
 	attr = IONIC_VF_ATTR_TRUST;
 	err = ionic_dev_cmd_vf_getattr(ionic, vf, attr, &comp);
 	if (err && comp.status != IONIC_RC_ENOSUPP)
 		goto err_out;
 	if (!err)
-		ionic->vfs[vf].trusted = comp.trust;
+		vfdata->trusted = comp.trust;
 
 	attr = IONIC_VF_ATTR_MAC;
 	err = ionic_dev_cmd_vf_getattr(ionic, vf, attr, &comp);
 	if (err && comp.status != IONIC_RC_ENOSUPP)
 		goto err_out;
 	if (!err)
-		ether_addr_copy(ionic->vfs[vf].macaddr, comp.macaddr);
+		ether_addr_copy(vfdata->macaddr, comp.macaddr);
 
 err_out:
 	if (err)
@@ -2295,6 +2295,7 @@ static int ionic_get_vf_config(struct net_device *netdev,
 {
 	struct ionic_lif *lif = netdev_priv(netdev);
 	struct ionic *ionic = lif->ionic;
+	struct ionic_vf vfdata = { 0 };
 	int ret = 0;
 
 	if (!netif_device_present(netdev))
@@ -2308,14 +2309,14 @@ static int ionic_get_vf_config(struct net_device *netdev,
 		ivf->vf = vf;
 		ivf->qos = 0;
 
-		ret = ionic_update_cached_vf_config(ionic, vf);
+		ret = ionic_get_fw_vf_config(ionic, vf, &vfdata);
 		if (!ret) {
-			ivf->vlan         = le16_to_cpu(ionic->vfs[vf].vlanid);
-			ivf->spoofchk     = ionic->vfs[vf].spoofchk;
-			ivf->linkstate    = ionic->vfs[vf].linkstate;
-			ivf->max_tx_rate  = le32_to_cpu(ionic->vfs[vf].maxrate);
-			ivf->trusted      = ionic->vfs[vf].trusted;
-			ether_addr_copy(ivf->mac, ionic->vfs[vf].macaddr);
+			ivf->vlan         = le16_to_cpu(vfdata.vlanid);
+			ivf->spoofchk     = vfdata.spoofchk;
+			ivf->linkstate    = vfdata.linkstate;
+			ivf->max_tx_rate  = le32_to_cpu(vfdata.maxrate);
+			ivf->trusted      = vfdata.trusted;
+			ether_addr_copy(ivf->mac, vfdata.macaddr);
 		}
 	}
 
Signature · 1 line
2.17.1
#5 lore raw

PATCH 3/5 ionic: new ionic device identity level and VF start control

In reply to Shannon Nelson

A new ionic dev_cmd is added to the interface in ionic_if.h, with a new capabilities field in the ionic device identity to signal its availability in the FW. The identity level code is incremented to '2' to show support for this new capabilities bitfield.

If the driver has indicated with the new identity level that it has the VF_CTRL command, newer FW will wait for the start command before starting the VFs after a FW update or crash recovery.

This patch updates the driver to make use of the new VF start control in fw_up path to be sure that the PF has set the user attributes on the VF before the FW allows the VFs to restart.

---
 .../net/ethernet/pensando/ionic/ionic_dev.c   | 20 +++++++++
 .../net/ethernet/pensando/ionic/ionic_dev.h   |  3 ++
 .../net/ethernet/pensando/ionic/ionic_if.h    | 41 +++++++++++++++++++
 .../net/ethernet/pensando/ionic/ionic_lif.c   |  2 +
 .../net/ethernet/pensando/ionic/ionic_main.c  |  2 +-
 5 files changed, 67 insertions(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_dev.c +20 -0
index 9d0514cfeb5c..20a0d87c9fce 100644
@@ -481,6 +481,26 @@ int ionic_dev_cmd_vf_getattr(struct ionic *ionic, int vf, u8 attr,
 	return err;
 }
 
+void ionic_vf_start(struct ionic *ionic, int vf)
+{
+	union ionic_dev_cmd cmd = {
+		.vf_ctrl.opcode = IONIC_CMD_VF_CTRL,
+	};
+
+	if (!(ionic->ident.dev.capabilities & cpu_to_le64(IONIC_DEV_CAP_VF_CTRL)))
+		return;
+
+	if (vf == -1) {
+		cmd.vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START_ALL;
+	} else {
+		cmd.vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START;
+		cmd.vf_ctrl.vf_index = cpu_to_le16(vf);
+	}
+
+	ionic_dev_cmd_go(&ionic->idev, &cmd);
+	(void)ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
+}
+
 /* LIF commands */
 void ionic_dev_cmd_queue_identify(struct ionic_dev *idev,
 				  u16 lif_type, u8 qtype, u8 qver)
drivers/net/ethernet/pensando/ionic/ionic_dev.h +3 -0
index 563c302eb033..b0329cfa7a1d 100644
@@ -124,6 +124,8 @@ static_assert(sizeof(struct ionic_vf_setattr_cmd) == 64);
 static_assert(sizeof(struct ionic_vf_setattr_comp) == 16);
 static_assert(sizeof(struct ionic_vf_getattr_cmd) == 64);
 static_assert(sizeof(struct ionic_vf_getattr_comp) == 16);
+static_assert(sizeof(struct ionic_vf_ctrl_cmd) == 64);
+static_assert(sizeof(struct ionic_vf_ctrl_comp) == 16);
 #endif /* __CHECKER__ */
 
 struct ionic_devinfo {
@@ -324,6 +326,7 @@ int ionic_dev_cmd_vf_getattr(struct ionic *ionic, int vf, u8 attr,
 			     struct ionic_vf_getattr_comp *comp);
 void ionic_dev_cmd_queue_identify(struct ionic_dev *idev,
 				  u16 lif_type, u8 qtype, u8 qver);
+void ionic_vf_start(struct ionic *ionic, int vf);
 void ionic_dev_cmd_lif_identify(struct ionic_dev *idev, u8 type, u8 ver);
 void ionic_dev_cmd_lif_init(struct ionic_dev *idev, u16 lif_index,
 			    dma_addr_t addr);
drivers/net/ethernet/pensando/ionic/ionic_if.h +41 -0

89 lines not on this page · raw message

drivers/net/ethernet/pensando/ionic/ionic_lif.c +2 -0
index 39a2e693e715..b5ade86b26a0 100644
@@ -2629,6 +2629,8 @@ static void ionic_vf_attr_replay(struct ionic_lif *lif)
 	}
 
 	up_read(&ionic->vf_op_lock);
+
+	ionic_vf_start(ionic, -1);
 }
 
 static const struct net_device_ops ionic_netdev_ops = {
drivers/net/ethernet/pensando/ionic/ionic_main.c +1 -1
index 56f93b030551..ed9d8c995236 100644
@@ -533,7 +533,7 @@ int ionic_identify(struct ionic *ionic)
 	sz = min(sizeof(ident->drv), sizeof(idev->dev_cmd_regs->data));
 	memcpy_toio(&idev->dev_cmd_regs->data, &ident->drv, sz);
 
-	ionic_dev_cmd_identify(idev, IONIC_IDENTITY_VERSION_1);
+	ionic_dev_cmd_identify(idev, IONIC_DEV_IDENTITY_VERSION_2);
 	err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
 	if (!err) {
 		sz = min(sizeof(ident->dev), sizeof(idev->dev_cmd_regs->data));
Signature · 1 line
2.17.1
#8 lore raw

PATCH 4/5 ionic: enable tunnel offloads

In reply to Shannon Nelson

From: Neel Patel <[email protected]>

Support stateless offloads for GRE, VXLAN, GENEVE, IPXIP4 and IPXIP6 when the FW supports them.

---
 drivers/net/ethernet/pensando/ionic/ionic_lif.c  | 8 +++++++-
 drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 8 ++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +7 -1
index b5ade86b26a0..cbfa3a9e626e 100644
@@ -1491,7 +1491,13 @@ static int ionic_init_nic_features(struct ionic_lif *lif)
 		   NETIF_F_RXCSUM |
 		   NETIF_F_TSO |
 		   NETIF_F_TSO6 |
-		   NETIF_F_TSO_ECN;
+		   NETIF_F_TSO_ECN |
+		   NETIF_F_GSO_GRE |
+		   NETIF_F_GSO_GRE_CSUM |
+		   NETIF_F_GSO_IPXIP4 |
+		   NETIF_F_GSO_IPXIP6 |
+		   NETIF_F_GSO_UDP_TUNNEL |
+		   NETIF_F_GSO_UDP_TUNNEL_CSUM;
 
 	if (lif->nxqs > 1)
 		features |= NETIF_F_RXHASH;
drivers/net/ethernet/pensando/ionic/ionic_txrx.c +6 -2
index c03986bf2628..190681aa7187 100644
@@ -925,8 +925,12 @@ static int ionic_tx_tso(struct ionic_queue *q, struct sk_buff *skb)
 
 	len = skb->len;
 	mss = skb_shinfo(skb)->gso_size;
-	outer_csum = (skb_shinfo(skb)->gso_type & SKB_GSO_GRE_CSUM) ||
-		     (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM);
+	outer_csum = (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
+						   SKB_GSO_GRE_CSUM |
+						   SKB_GSO_IPXIP4 |
+						   SKB_GSO_IPXIP6 |
+						   SKB_GSO_UDP_TUNNEL |
+						   SKB_GSO_UDP_TUNNEL_CSUM));
 	has_vlan = !!skb_vlan_tag_present(skb);
 	vlan_tci = skb_vlan_tag_get(skb);
 	encap = skb->encapsulation;
Signature · 1 line
2.17.1
#9 lore raw

PATCH 5/5 ionic: refactor use of ionic_rx_fill()

In reply to Shannon Nelson

From: Neel Patel <[email protected]>

The same pre-work code is used before each call to ionic_rx_fill(), so bring it in and make it a part of the routine.

---
 .../net/ethernet/pensando/ionic/ionic_txrx.c  | 23 ++++++++++---------
 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_txrx.c +12 -11
index 190681aa7187..0c3977416cd1 100644
@@ -348,16 +348,25 @@ void ionic_rx_fill(struct ionic_queue *q)
 	struct ionic_rxq_sg_desc *sg_desc;
 	struct ionic_rxq_sg_elem *sg_elem;
 	struct ionic_buf_info *buf_info;
+	unsigned int fill_threshold;
 	struct ionic_rxq_desc *desc;
 	unsigned int remain_len;
 	unsigned int frag_len;
 	unsigned int nfrags;
+	unsigned int n_fill;
 	unsigned int i, j;
 	unsigned int len;
 
+	n_fill = ionic_q_space_avail(q);
+
+	fill_threshold = min_t(unsigned int, IONIC_RX_FILL_THRESHOLD,
+			       q->num_descs / IONIC_RX_FILL_DIV);
+	if (n_fill < fill_threshold)
+		return;
+
 	len = netdev->mtu + ETH_HLEN + VLAN_HLEN;
 
-	for (i = ionic_q_space_avail(q); i; i--) {
+	for (i = n_fill; i; i--) {
 		nfrags = 0;
 		remain_len = len;
 		desc_info = &q->info[q->head_idx];
@@ -511,7 +520,6 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
 	struct ionic_cq *cq = napi_to_cq(napi);
 	struct ionic_dev *idev;
 	struct ionic_lif *lif;
-	u16 rx_fill_threshold;
 	u32 work_done = 0;
 	u32 flags = 0;
 
@@ -521,10 +529,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
 	work_done = ionic_cq_service(cq, budget,
 				     ionic_rx_service, NULL, NULL);
 
-	rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD,
-				  cq->num_descs / IONIC_RX_FILL_DIV);
-	if (work_done && ionic_q_space_avail(cq->bound_q) >= rx_fill_threshold)
-		ionic_rx_fill(cq->bound_q);
+	ionic_rx_fill(cq->bound_q);
 
 	if (work_done < budget && napi_complete_done(napi, work_done)) {
 		ionic_dim_update(qcq, IONIC_LIF_F_RX_DIM_INTR);
@@ -550,7 +555,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
 	struct ionic_dev *idev;
 	struct ionic_lif *lif;
 	struct ionic_cq *txcq;
-	u16 rx_fill_threshold;
 	u32 rx_work_done = 0;
 	u32 tx_work_done = 0;
 	u32 flags = 0;
@@ -565,10 +569,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
 	rx_work_done = ionic_cq_service(rxcq, budget,
 					ionic_rx_service, NULL, NULL);
 
-	rx_fill_threshold = min_t(u16, IONIC_RX_FILL_THRESHOLD,
-				  rxcq->num_descs / IONIC_RX_FILL_DIV);
-	if (rx_work_done && ionic_q_space_avail(rxcq->bound_q) >= rx_fill_threshold)
-		ionic_rx_fill(rxcq->bound_q);
+	ionic_rx_fill(rxcq->bound_q);
 
 	if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) {
 		ionic_dim_update(qcq, 0);
Signature · 1 line
2.17.1
#6 lore raw

Re: [PATCH net-next 3/5] ionic: new ionic device identity level and VF start control

In reply to Shannon Nelson
Quoted 47 lines · Shannon Nelson

A new ionic dev_cmd is added to the interface in ionic_if.h, with a new capabilities field in the ionic device identity to signal its availability in the FW. The identity level code is incremented to '2' to show support for this new capabilities bitfield.

If the driver has indicated with the new identity level that it has the VF_CTRL command, newer FW will wait for the start command before starting the VFs after a FW update or crash recovery.

This patch updates the driver to make use of the new VF start control in fw_up path to be sure that the PF has set the user attributes on the VF before the FW allows the VFs to restart.

---
 .../net/ethernet/pensando/ionic/ionic_dev.c   | 20 +++++++++
 .../net/ethernet/pensando/ionic/ionic_dev.h   |  3 ++
 .../net/ethernet/pensando/ionic/ionic_if.h    | 41 +++++++++++++++++++
 .../net/ethernet/pensando/ionic/ionic_lif.c   |  2 +
 .../net/ethernet/pensando/ionic/ionic_main.c  |  2 +-
 5 files changed, 67 insertions(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_dev.c +15 -0
index 9d0514cfeb5c..20a0d87c9fce 100644
@@ -481,6 +481,26 @@ int ionic_dev_cmd_vf_getattr(struct ionic *ionic, int vf, u8 attr,
 	return err;
 }
 
+void ionic_vf_start(struct ionic *ionic, int vf)
+{
+	union ionic_dev_cmd cmd = {
+		.vf_ctrl.opcode = IONIC_CMD_VF_CTRL,
+	};
+
+	if (!(ionic->ident.dev.capabilities & cpu_to_le64(IONIC_DEV_CAP_VF_CTRL)))
+		return;
+
+	if (vf == -1) {
+		cmd.vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START_ALL;
+	} else {
+		cmd.vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START;
+		cmd.vf_ctrl.vf_index = cpu_to_le16(vf);
+	}

<...>

drivers/net/ethernet/pensando/ionic/ionic_dev.c

Quoted 1 line
drivers/net/ethernet/pensando/ionic/ionic_dev.c +1 -0
+	ionic_vf_start(ionic, -1)

I see only call with "-1" in this series. It is better to add code when it is actually used.

Thanks

#2 lore raw

Re: [PATCH net-next 1/5] ionic: replay VF attributes after fw crash recovery

In reply to Shannon Nelson
Quoted 16 lines · Shannon Nelson

The VF attributes that the user has set into the FW through the PF can be lost over a FW crash recovery. Much like we already replay the PF mac/vlan filters, we now add a replay in the recovery path to be sure the FW has the up-to-date VF configurations.

---
 .../net/ethernet/pensando/ionic/ionic_lif.c   | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +0 -0
index 19d4848df17d..5d593198ad72 100644

drivers/net/ethernet/pensando/ionic/ionic_lif.c static int ionic_set_vf_link_state(struct net_device *netdev, int vf, int set) · line 2567

Quoted 6 lines
drivers/net/ethernet/pensando/ionic/ionic_lif.c +3 -0
@@ -2562,6 +2562,74 @@ static int ionic_set_vf_link_state(struct net_device *netdev, int vf, int set)
 	return ret;
 }
 
+static void ionic_vf_attr_replay(struct ionic_lif *lif)
+{
+	struct ionic_vf_setattr_cmd vfc = { 0 };

There is no need in 0 for {} installations.

<...>

drivers/net/ethernet/pensando/ionic/ionic_lif.c static int ionic_set_vf_link_state(struct net_device *netdev, int vf, int set) · line 2568

Quoted 1 line
drivers/net/ethernet/pensando/ionic/ionic_lif.c +1 -0
+			(void)ionic_set_vf_config(ionic, i, &vfc);

No need to cast return type of function, it is not kernel style.

Thanks

#3 lore raw

Re: [PATCH net-next 1/5] ionic: replay VF attributes after fw crash recovery

Quoted 29 lines · Leon Romanovsky

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Quoted 16 lines · Shannon Nelson

The VF attributes that the user has set into the FW through the PF can be lost over a FW crash recovery. Much like we already replay the PF mac/vlan filters, we now add a replay in the recovery path to be sure the FW has the up-to-date VF configurations.

---
  .../net/ethernet/pensando/ionic/ionic_lif.c   | 70 +++++++++++++++++++
  1 file changed, 70 insertions(+)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +0 -0
index 19d4848df17d..5d593198ad72 100644

drivers/net/ethernet/pensando/ionic/ionic_lif.c static int ionic_set_vf_link_state(struct net_device *netdev, int vf, int set) · line 2567

Quoted 6 lines
drivers/net/ethernet/pensando/ionic/ionic_lif.c +3 -0
@@ -2562,6 +2562,74 @@ static int ionic_set_vf_link_state(struct net_device *netdev, int vf, int set)
       return ret;
  }
 
+static void ionic_vf_attr_replay(struct ionic_lif *lif)
+{
+     struct ionic_vf_setattr_cmd vfc = { 0 };

There is no need in 0 for {} installations.

Quoted 7 lines

<...>

Quoted 1 line

+ (void)ionic_set_vf_config(ionic, i, &vfc);

No need to cast return type of function, it is not kernel style.

Thanks

Sure, I'll fix those up - thanks.
sln

#7 lore raw

Re: [PATCH net-next 3/5] ionic: new ionic device identity level and VF start control

In reply to Leon Romanovsky
Quoted 52 lines · Leon Romanovsky
Quoted 47 lines · Shannon Nelson

A new ionic dev_cmd is added to the interface in ionic_if.h, with a new capabilities field in the ionic device identity to signal its availability in the FW. The identity level code is incremented to '2' to show support for this new capabilities bitfield.

If the driver has indicated with the new identity level that it has the VF_CTRL command, newer FW will wait for the start command before starting the VFs after a FW update or crash recovery.

This patch updates the driver to make use of the new VF start control in fw_up path to be sure that the PF has set the user attributes on the VF before the FW allows the VFs to restart.

---
  .../net/ethernet/pensando/ionic/ionic_dev.c   | 20 +++++++++
  .../net/ethernet/pensando/ionic/ionic_dev.h   |  3 ++
  .../net/ethernet/pensando/ionic/ionic_if.h    | 41 +++++++++++++++++++
  .../net/ethernet/pensando/ionic/ionic_lif.c   |  2 +
  .../net/ethernet/pensando/ionic/ionic_main.c  |  2 +-
  5 files changed, 67 insertions(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_dev.c +15 -0
index 9d0514cfeb5c..20a0d87c9fce 100644
@@ -481,6 +481,26 @@ int ionic_dev_cmd_vf_getattr(struct ionic *ionic, int vf, u8 attr,
       return err;
  }
 
+void ionic_vf_start(struct ionic *ionic, int vf)
+{
+     union ionic_dev_cmd cmd = {
+             .vf_ctrl.opcode = IONIC_CMD_VF_CTRL,
+     };
+
+     if (!(ionic->ident.dev.capabilities & cpu_to_le64(IONIC_DEV_CAP_VF_CTRL)))
+             return;
+
+     if (vf == -1) {
+             cmd.vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START_ALL;
+     } else {
+             cmd.vf_ctrl.ctrl_opcode = IONIC_VF_CTRL_START;
+             cmd.vf_ctrl.vf_index = cpu_to_le16(vf);
+     }

<...>

Quoted 6 lines
Quoted 1 line

+ ionic_vf_start(ionic, -1)

I see only call with "-1" in this series. It is better to add code when it is actually used.

Thanks

I'll clean that up - thanks.
sln