]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
octeontx2-pf: Reuse PF max mtu value
authorGeetha sowjanya <gakula@marvell.com>
Wed, 23 Oct 2024 16:18:42 +0000 (21:48 +0530)
committerJakub Kicinski <kuba@kernel.org>
Thu, 31 Oct 2024 00:50:32 +0000 (17:50 -0700)
Reuse the maximum support HW MTU value that is fetch during probe.
Instead of fetching through mbox each time mtu is changed as the
value is fixed for interface.

Signed-off-by: Geetha sowjanya <gakula@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241023161843.15543-4-gakula@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c

index 7510a918d942c0d1a4bc217af5a7dd1a382e0af1..6e0183f0d5a12fb6784ab16d535d7e9ca98877a8 100644 (file)
@@ -227,7 +227,7 @@ int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu)
        u16 maxlen;
        int err;
 
-       maxlen = otx2_get_max_mtu(pfvf) + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
+       maxlen = pfvf->hw.max_mtu + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
 
        mutex_lock(&pfvf->mbox.lock);
        req = otx2_mbox_alloc_msg_nix_set_hw_frs(&pfvf->mbox);
@@ -236,7 +236,7 @@ int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu)
                return -ENOMEM;
        }
 
-       req->maxlen = pfvf->netdev->mtu + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
+       req->maxlen = mtu + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
 
        /* Use max receive length supported by hardware for loopback devices */
        if (is_otx2_lbkvf(pfvf->pdev))
index df548aeffecf240797e364367f7c8ae0d17e3120..b36b87dae2cb38c22c304cd6580e275408619542 100644 (file)
@@ -228,6 +228,7 @@ struct otx2_hw {
        u16                     txschq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
        u16                     matchall_ipolicer;
        u32                     dwrr_mtu;
+       u32                     max_mtu;
        u8                      smq_link_type;
 
        /* HW settings, coalescing etc */
index 1185f1bdfa014c0d4787dc3073be305330ff6fff..15ed1305fbf8dac5f84ef9642a184edb43eb20dd 100644 (file)
@@ -3101,6 +3101,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        netdev->min_mtu = OTX2_MIN_MTU;
        netdev->max_mtu = otx2_get_max_mtu(pf);
+       hw->max_mtu = netdev->max_mtu;
 
        /* reset CGX/RPM MAC stats */
        otx2_reset_mac_stats(pf);
index 99fcc5661674bebf20f2f9ac0c6ef74e085b6d6f..79a8acac628340ac745c25c7c02a9a3be9bc3afe 100644 (file)
@@ -671,6 +671,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        netdev->min_mtu = OTX2_MIN_MTU;
        netdev->max_mtu = otx2_get_max_mtu(vf);
+       hw->max_mtu = netdev->max_mtu;
 
        /* To distinguish, for LBK VFs set netdev name explicitly */
        if (is_otx2_lbkvf(vf->pdev)) {