Skip to content

Commit dec6f5e

Browse files
Geetha sowjanyakuba-moo
authored andcommitted
octeontx2-pf: Reuse PF max mtu value
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 <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 03d80a1 commit dec6f5e

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu)
227227
u16 maxlen;
228228
int err;
229229

230-
maxlen = otx2_get_max_mtu(pfvf) + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
230+
maxlen = pfvf->hw.max_mtu + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
231231

232232
mutex_lock(&pfvf->mbox.lock);
233233
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)
236236
return -ENOMEM;
237237
}
238238

239-
req->maxlen = pfvf->netdev->mtu + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
239+
req->maxlen = mtu + OTX2_ETH_HLEN + OTX2_HW_TIMESTAMP_LEN;
240240

241241
/* Use max receive length supported by hardware for loopback devices */
242242
if (is_otx2_lbkvf(pfvf->pdev))

drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ struct otx2_hw {
228228
u16 txschq_list[NIX_TXSCH_LVL_CNT][MAX_TXSCHQ_PER_FUNC];
229229
u16 matchall_ipolicer;
230230
u32 dwrr_mtu;
231+
u32 max_mtu;
231232
u8 smq_link_type;
232233

233234
/* HW settings, coalescing etc */

drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3101,6 +3101,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
31013101

31023102
netdev->min_mtu = OTX2_MIN_MTU;
31033103
netdev->max_mtu = otx2_get_max_mtu(pf);
3104+
hw->max_mtu = netdev->max_mtu;
31043105

31053106
/* reset CGX/RPM MAC stats */
31063107
otx2_reset_mac_stats(pf);

drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
671671

672672
netdev->min_mtu = OTX2_MIN_MTU;
673673
netdev->max_mtu = otx2_get_max_mtu(vf);
674+
hw->max_mtu = netdev->max_mtu;
674675

675676
/* To distinguish, for LBK VFs set netdev name explicitly */
676677
if (is_otx2_lbkvf(vf->pdev)) {

0 commit comments

Comments
 (0)