Skip to contentSkip to conversation

liquidio: VF driver will notify NIC firmware of MTU change

PATCH In review Felix Manlunas 2 participants 4 messages Aug 21, 2017 – Aug 22, 2017

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

v2 cover liquidio: VF driver will notify NIC firmware of MTU change

From: Veerasenareddy Burru <[email protected]>

Make VF driver notify NIC firmware of MTU change. Firmware needs this information for MTU propagation and enforcement.

The first patch in this series moves a macro definition to a proper place to prevent a build error in the second patch which has the code that sends the notification.

Change Log:
V1 -> V2
* Add "From:" line to patch #1 and #2 to give credit to the author.
* In patch #2, order local variable declarations from longest to shortest line.

Veerasenareddy Burru (2):
liquidio: move macro definition to a proper place
liquidio: make VF driver notify NIC firmware of MTU change

 .../ethernet/cavium/liquidio/cn23xx_pf_device.h    |  2 --
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 27 ++++++++++++++++++----
 .../net/ethernet/cavium/liquidio/liquidio_common.h |  2 ++
 3 files changed, 24 insertions(+), 7 deletions(-)
Signature · 1 line
2.9.0
#1 lore raw

PATCH v2 1/2 liquidio: move macro definition to a proper place

From: Veerasenareddy Burru <[email protected]>

The macro LIO_CMD_WAIT_TM is not specific to the PF driver; it can be used by the VF driver too, so move its definition from a PF-specific header file to one that's common to PF and VF.

---
 drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.h | 2 --
 drivers/net/ethernet/cavium/liquidio/liquidio_common.h  | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.h +0 -2
index dee6046..2aba524 100644
@@ -24,8 +24,6 @@
 
 #include "cn23xx_pf_regs.h"
 
-#define LIO_CMD_WAIT_TM 100
-
 /* Register address and configuration for a CN23XX devices.
  * If device specific changes need to be made then add a struct to include
  * device specific fields as shown in the commented section
drivers/net/ethernet/cavium/liquidio/liquidio_common.h +2 -0
index 906e30a..d0076c1 100644
@@ -237,6 +237,8 @@ static inline void add_sg_size(struct octeon_sg_entry *sg_entry,
 #define   OCTNET_CMD_VLAN_FILTER_ENABLE 0x1
 #define   OCTNET_CMD_VLAN_FILTER_DISABLE 0x0
 
+#define   LIO_CMD_WAIT_TM 100
+
 /* RX(packets coming from wire) Checksum verification flags */
 /* TCP/UDP csum */
 #define   CNNIC_L4SUM_VERIFIED             0x1
Signature · 1 line
2.9.0
#2 lore raw

PATCH v2 2/2 liquidio: make VF driver notify NIC firmware of MTU change

In reply to Felix Manlunas

From: Veerasenareddy Burru <[email protected]>

---
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 27 ++++++++++++++++++----
 1 file changed, 22 insertions(+), 5 deletions(-)
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +22 -5
index 0402b18..2e993ce 100644
@@ -1544,14 +1544,31 @@ static struct net_device_stats *liquidio_get_stats(struct net_device *netdev)
  */
 static int liquidio_change_mtu(struct net_device *netdev, int new_mtu)
 {
-	struct lio *lio = GET_LIO(netdev);
+	struct octnic_ctrl_pkt nctrl;
+	struct octeon_device *oct;
+	struct lio *lio;
+	int ret = 0;
 
-	lio->mtu = new_mtu;
+	lio = GET_LIO(netdev);
+	oct = lio->oct_dev;
+
+	memset(&nctrl, 0, sizeof(struct octnic_ctrl_pkt));
 
-	netif_info(lio, probe, lio->netdev, "MTU Changed from %d to %d\n",
-		   netdev->mtu, new_mtu);
+	nctrl.ncmd.u64 = 0;
+	nctrl.ncmd.s.cmd = OCTNET_CMD_CHANGE_MTU;
+	nctrl.ncmd.s.param1 = new_mtu;
+	nctrl.iq_no = lio->linfo.txpciq[0].s.q_no;
+	nctrl.wait_time = LIO_CMD_WAIT_TM;
+	nctrl.netpndev = (u64)netdev;
+	nctrl.cb_fn = liquidio_link_ctrl_cmd_completion;
+
+	ret = octnet_send_nic_ctrl_pkt(lio->oct_dev, &nctrl);
+	if (ret < 0) {
+		dev_err(&oct->pci_dev->dev, "Failed to set MTU\n");
+		return -EIO;
+	}
 
-	netdev->mtu = new_mtu;
+	lio->mtu = new_mtu;
 
 	return 0;
 }
Signature · 1 line
2.9.0
maintainer
#3 lore raw
In reply to Felix Manlunas

From: Felix Manlunas <[email protected]>
Date: Mon, 21 Aug 2017 12:35:27 -0700

Quoted 9 lines

From: Veerasenareddy Burru <[email protected]>

Make VF driver notify NIC firmware of MTU change. Firmware needs this information for MTU propagation and enforcement.

The first patch in this series moves a macro definition to a proper place to prevent a build error in the second patch which has the code that sends the notification.

Quoted 5 lines

Change Log:
V1 -> V2
* Add "From:" line to patch #1 and #2 to give credit to the author.
* In patch #2, order local variable declarations from longest to shortest line.

Series applied.