Skip to content

Commit

Permalink
common/cnxk: fix mbuf data offset for VF
Browse files Browse the repository at this point in the history
[ upstream commit 8f98e3e ]

If PF has PTP enabled the data offset should be adjusted for VF to
skip extra 8 bytes of timestamp as the MAC inserts 8 bytes before
the ethernet header.

Fixes: c443e0d ("common/cnxk: support NIX PTP")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
  • Loading branch information
Harman Kalra authored and kevintraynor committed Mar 8, 2022
1 parent 552ab17 commit c22759e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/common/cnxk/roc_nix.h
Expand Up @@ -808,6 +808,7 @@ int __roc_api roc_nix_ptp_sync_time_adjust(struct roc_nix *roc_nix,
int __roc_api roc_nix_ptp_info_cb_register(struct roc_nix *roc_nix,
ptp_info_update_t ptp_update);
void __roc_api roc_nix_ptp_info_cb_unregister(struct roc_nix *roc_nix);
bool __roc_api roc_nix_ptp_is_enable(struct roc_nix *roc_nix);

/* VLAN */
int __roc_api
Expand Down
8 changes: 8 additions & 0 deletions drivers/common/cnxk/roc_nix_ptp.c
Expand Up @@ -120,3 +120,11 @@ roc_nix_ptp_info_cb_unregister(struct roc_nix *roc_nix)

dev->ops->ptp_info_update = NULL;
}

bool
roc_nix_ptp_is_enable(struct roc_nix *roc_nix)
{
struct nix *nix = roc_nix_to_nix_priv(roc_nix);

return nix->ptp_en;
}
1 change: 1 addition & 0 deletions drivers/common/cnxk/version.map
Expand Up @@ -198,6 +198,7 @@ INTERNAL {
roc_nix_ptp_clock_read;
roc_nix_ptp_info_cb_register;
roc_nix_ptp_info_cb_unregister;
roc_nix_ptp_is_enable;
roc_nix_ptp_rx_ena_dis;
roc_nix_ptp_sync_time_adjust;
roc_nix_ptp_tx_ena_dis;
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/cnxk/cnxk_ethdev.c
Expand Up @@ -1131,6 +1131,10 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
goto fail_configure;
}

/* Check if ptp is enable in PF owning this VF*/
if (!roc_nix_is_pf(nix) && (!roc_nix_is_sdp(nix)))
dev->ptp_en = roc_nix_ptp_is_enable(nix);

dev->npc.channel = roc_nix_get_base_chan(nix);

nb_rxq = data->nb_rx_queues;
Expand Down

0 comments on commit c22759e

Please sign in to comment.