lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: 
 <SJ0PR18MB5216EA9C653D155E3F4A5D89DBBAA@SJ0PR18MB5216.namprd18.prod.outlook.com>
Date: Wed, 22 Nov 2023 04:42:36 +0000
From: Suman Ghosh <sumang@...vell.com>
To: Shinas Rasheed <srasheed@...vell.com>,
        "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
CC: Haseeb Gani <hgani@...vell.com>, Vimlesh Kumar <vimleshk@...vell.com>,
        "egallen@...hat.com" <egallen@...hat.com>,
        "mschmidt@...hat.com"
	<mschmidt@...hat.com>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "horms@...nel.org" <horms@...nel.org>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "wizhao@...hat.com"
	<wizhao@...hat.com>,
        "konguyen@...hat.com" <konguyen@...hat.com>,
        Shinas
 Rasheed <srasheed@...vell.com>,
        Veerasenareddy Burru <vburru@...vell.com>,
        Sathesh B Edara <sedara@...vell.com>,
        Eric Dumazet <edumazet@...gle.com>
Subject: RE: [EXT] [PATCH net-next v1] octeon_ep: get max rx packet length
 from firmware

>Signed-off-by: Shinas Rasheed <srasheed@...vell.com>
>---
> .../marvell/octeon_ep/octep_ctrl_net.c         | 18 ++++++++++++++++++
> .../marvell/octeon_ep/octep_ctrl_net.h         |  9 +++++++++
> .../ethernet/marvell/octeon_ep/octep_main.c    | 10 +++++++++-
> 3 files changed, 36 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
>b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
>index 6dd3d03c1c0f..c9fcebb9bd9b 100644
>--- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
>+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.c
>@@ -198,6 +198,24 @@ int octep_ctrl_net_set_mac_addr(struct octep_device
>*oct, int vfid, u8 *addr,
> 	return octep_send_mbox_req(oct, &d, wait_for_response);  }
>
>+int octep_ctrl_net_get_mtu(struct octep_device *oct, int vfid) {
>+	struct octep_ctrl_net_wait_data d = {0};
>+	struct octep_ctrl_net_h2f_req *req;
>+	int err;
>+
>+	req = &d.data.req;
>+	init_send_req(&d.msg, req, mtu_sz, vfid);
>+	req->hdr.s.cmd = OCTEP_CTRL_NET_H2F_CMD_MTU;
>+	req->mtu.cmd = OCTEP_CTRL_NET_CMD_GET;
>+
>+	err = octep_send_mbox_req(oct, &d, true);
>+	if (err < 0)
>+		return err;
>+
>+	return d.data.resp.mtu.val;
>+}
>+
> int octep_ctrl_net_set_mtu(struct octep_device *oct, int vfid, int mtu,
> 			   bool wait_for_response)
> {
>diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h
>b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h
>index 4bb97ad1f1c6..46ddaa5c64d1 100644
>--- a/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h
>+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_ctrl_net.h
>@@ -282,6 +282,15 @@ int octep_ctrl_net_get_mac_addr(struct octep_device
>*oct, int vfid, u8 *addr);  int octep_ctrl_net_set_mac_addr(struct
>octep_device *oct, int vfid, u8 *addr,
> 				bool wait_for_response);
>
>+/** Get max MTU from firmware.
>+ *
>+ * @param oct: non-null pointer to struct octep_device.
>+ * @param vfid: Index of virtual function.
>+ *
>+ * return value: mtu on success, -errno on failure.
>+ */
>+int octep_ctrl_net_get_mtu(struct octep_device *oct, int vfid);
>+
> /** Set mtu in firmware.
>  *
>  * @param oct: non-null pointer to struct octep_device.
>diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
>b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
>index 3cee69b3ac38..f9c539178114 100644
>--- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
>+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
>@@ -1276,6 +1276,7 @@ static int octep_probe(struct pci_dev *pdev, const
>struct pci_device_id *ent)  {
> 	struct octep_device *octep_dev = NULL;
> 	struct net_device *netdev;
>+	int max_rx_pktlen;
> 	int err;
>
> 	err = pci_enable_device(pdev);
>@@ -1346,8 +1347,15 @@ static int octep_probe(struct pci_dev *pdev,
>const struct pci_device_id *ent)
>
> 	netdev->hw_features = NETIF_F_SG;
> 	netdev->features |= netdev->hw_features;
>+
>+	max_rx_pktlen = octep_ctrl_net_get_mtu(octep_dev,
>OCTEP_CTRL_NET_INVALID_VFID);
>+	if (max_rx_pktlen < 0) {
>+		dev_err(&octep_dev->pdev->dev,
>+			"Failed to get max receive packet size; err = %d\n",
>max_rx_pktlen);
>+		goto register_dev_err;
>+	}
[Suman] Do we need to check if max_rx_pktlen <= OCTEP_MAX_MTU as well? If not, then this macro is not required further after the change?

> 	netdev->min_mtu = OCTEP_MIN_MTU;
>-	netdev->max_mtu = OCTEP_MAX_MTU;
>+	netdev->max_mtu = max_rx_pktlen - (ETH_HLEN + ETH_FCS_LEN);
> 	netdev->mtu = OCTEP_DEFAULT_MTU;
>
> 	err = octep_ctrl_net_get_mac_addr(octep_dev,
>OCTEP_CTRL_NET_INVALID_VFID,
>--
>2.25.1
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ