]> git.droids-corp.org - dpdk.git/commitdiff
net/octeontx2: fix MTU when PTP is enabled
authorHanumanth Reddy Pothula <hpothula@marvell.com>
Tue, 10 Aug 2021 07:21:00 +0000 (12:51 +0530)
committerJerin Jacob <jerinj@marvell.com>
Thu, 16 Sep 2021 14:29:51 +0000 (16:29 +0200)
Update MTU value based on PTP enable status and reserve eight
bytes in TX path to accommodate VLAN tags.

If PTP is enabled maximum allowed MTU is 9200 otherwise it's 9208.

Fixes: b5dc3140448e ("net/octeontx2: support base PTP")
Cc: stable@dpdk.org
Signed-off-by: Hanumanth Reddy Pothula <hpothula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/net/octeontx2/otx2_ethdev_ops.c

index 5a4501208e9e33feb79c681246a30c63ea344c24..552e6bd43d2b433bae79be5ea2f1b84f697a8bf3 100644 (file)
@@ -17,7 +17,8 @@ otx2_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
        struct nix_frs_cfg *req;
        int rc;
 
-       frame_size += NIX_TIMESYNC_RX_OFFSET * otx2_ethdev_is_ptp_en(dev);
+       if (dev->configured && otx2_ethdev_is_ptp_en(dev))
+               frame_size += NIX_TIMESYNC_RX_OFFSET;
 
        /* Check if MTU is within the allowed range */
        if (frame_size < NIX_MIN_FRS || frame_size > NIX_MAX_FRS)
@@ -547,6 +548,11 @@ otx2_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *devinfo)
        devinfo->max_vfs = pci_dev->max_vfs;
        devinfo->max_mtu = devinfo->max_rx_pktlen - NIX_L2_OVERHEAD;
        devinfo->min_mtu = devinfo->min_rx_bufsize - NIX_L2_OVERHEAD;
+       if (dev->configured && otx2_ethdev_is_ptp_en(dev)) {
+               devinfo->max_mtu -=  NIX_TIMESYNC_RX_OFFSET;
+               devinfo->min_mtu -=  NIX_TIMESYNC_RX_OFFSET;
+               devinfo->max_rx_pktlen -= NIX_TIMESYNC_RX_OFFSET;
+       }
 
        devinfo->rx_offload_capa = dev->rx_offload_capa;
        devinfo->tx_offload_capa = dev->tx_offload_capa;