mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 12:03:54 +02:00
bnxt_en: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set()
Convert bnxt dirver to use new timestamping configuration API. Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Reviewed-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Link: https://patch.msgid.link/20250923173310.139623-3-vadim.fedorenko@linux.dev Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
de0aa209b9
commit
bd94c3649b
|
|
@ -13278,12 +13278,6 @@ static int bnxt_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
|||
return bnxt_hwrm_port_phy_write(bp, mdio->phy_id, mdio->reg_num,
|
||||
mdio->val_in);
|
||||
|
||||
case SIOCSHWTSTAMP:
|
||||
return bnxt_hwtstamp_set(dev, ifr);
|
||||
|
||||
case SIOCGHWTSTAMP:
|
||||
return bnxt_hwtstamp_get(dev, ifr);
|
||||
|
||||
default:
|
||||
/* do nothing */
|
||||
break;
|
||||
|
|
@ -15806,6 +15800,8 @@ static const struct net_device_ops bnxt_netdev_ops = {
|
|||
.ndo_xdp_xmit = bnxt_xdp_xmit,
|
||||
.ndo_bridge_getlink = bnxt_bridge_getlink,
|
||||
.ndo_bridge_setlink = bnxt_bridge_setlink,
|
||||
.ndo_hwtstamp_get = bnxt_hwtstamp_get,
|
||||
.ndo_hwtstamp_set = bnxt_hwtstamp_set,
|
||||
};
|
||||
|
||||
static void bnxt_get_queue_stats_rx(struct net_device *dev, int i,
|
||||
|
|
|
|||
|
|
@ -560,10 +560,11 @@ static int bnxt_hwrm_ptp_cfg(struct bnxt *bp)
|
|||
return bnxt_ptp_cfg_tstamp_filters(bp);
|
||||
}
|
||||
|
||||
int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
|
||||
int bnxt_hwtstamp_set(struct net_device *dev,
|
||||
struct kernel_hwtstamp_config *stmpconf,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
struct hwtstamp_config stmpconf;
|
||||
struct bnxt_ptp_cfg *ptp;
|
||||
u16 old_rxctl;
|
||||
int old_rx_filter, rc;
|
||||
|
|
@ -573,17 +574,14 @@ int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
|
|||
if (!ptp)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (copy_from_user(&stmpconf, ifr->ifr_data, sizeof(stmpconf)))
|
||||
return -EFAULT;
|
||||
|
||||
if (stmpconf.tx_type != HWTSTAMP_TX_ON &&
|
||||
stmpconf.tx_type != HWTSTAMP_TX_OFF)
|
||||
if (stmpconf->tx_type != HWTSTAMP_TX_ON &&
|
||||
stmpconf->tx_type != HWTSTAMP_TX_OFF)
|
||||
return -ERANGE;
|
||||
|
||||
old_rx_filter = ptp->rx_filter;
|
||||
old_rxctl = ptp->rxctl;
|
||||
old_tx_tstamp_en = ptp->tx_tstamp_en;
|
||||
switch (stmpconf.rx_filter) {
|
||||
switch (stmpconf->rx_filter) {
|
||||
case HWTSTAMP_FILTER_NONE:
|
||||
ptp->rxctl = 0;
|
||||
ptp->rx_filter = HWTSTAMP_FILTER_NONE;
|
||||
|
|
@ -616,7 +614,7 @@ int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
|
|||
return -ERANGE;
|
||||
}
|
||||
|
||||
if (stmpconf.tx_type == HWTSTAMP_TX_ON)
|
||||
if (stmpconf->tx_type == HWTSTAMP_TX_ON)
|
||||
ptp->tx_tstamp_en = 1;
|
||||
else
|
||||
ptp->tx_tstamp_en = 0;
|
||||
|
|
@ -625,9 +623,8 @@ int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
|
|||
if (rc)
|
||||
goto ts_set_err;
|
||||
|
||||
stmpconf.rx_filter = ptp->rx_filter;
|
||||
return copy_to_user(ifr->ifr_data, &stmpconf, sizeof(stmpconf)) ?
|
||||
-EFAULT : 0;
|
||||
stmpconf->rx_filter = ptp->rx_filter;
|
||||
return 0;
|
||||
|
||||
ts_set_err:
|
||||
ptp->rx_filter = old_rx_filter;
|
||||
|
|
@ -636,22 +633,22 @@ int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr)
|
|||
return rc;
|
||||
}
|
||||
|
||||
int bnxt_hwtstamp_get(struct net_device *dev, struct ifreq *ifr)
|
||||
int bnxt_hwtstamp_get(struct net_device *dev,
|
||||
struct kernel_hwtstamp_config *stmpconf)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
struct hwtstamp_config stmpconf;
|
||||
struct bnxt_ptp_cfg *ptp;
|
||||
|
||||
ptp = bp->ptp_cfg;
|
||||
if (!ptp)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
stmpconf.flags = 0;
|
||||
stmpconf.tx_type = ptp->tx_tstamp_en ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
|
||||
stmpconf->flags = 0;
|
||||
stmpconf->tx_type = ptp->tx_tstamp_en ? HWTSTAMP_TX_ON
|
||||
: HWTSTAMP_TX_OFF;
|
||||
|
||||
stmpconf.rx_filter = ptp->rx_filter;
|
||||
return copy_to_user(ifr->ifr_data, &stmpconf, sizeof(stmpconf)) ?
|
||||
-EFAULT : 0;
|
||||
stmpconf->rx_filter = ptp->rx_filter;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bnxt_map_regs(struct bnxt *bp, u32 *reg_arr, int count, int reg_win)
|
||||
|
|
|
|||
|
|
@ -160,8 +160,11 @@ void bnxt_ptp_update_current_time(struct bnxt *bp);
|
|||
void bnxt_ptp_pps_event(struct bnxt *bp, u32 data1, u32 data2);
|
||||
int bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp);
|
||||
void bnxt_ptp_reapply_pps(struct bnxt *bp);
|
||||
int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr);
|
||||
int bnxt_hwtstamp_get(struct net_device *dev, struct ifreq *ifr);
|
||||
int bnxt_hwtstamp_set(struct net_device *dev,
|
||||
struct kernel_hwtstamp_config *stmpconf,
|
||||
struct netlink_ext_ack *extack);
|
||||
int bnxt_hwtstamp_get(struct net_device *dev,
|
||||
struct kernel_hwtstamp_config *stmpconf);
|
||||
void bnxt_ptp_free_txts_skbs(struct bnxt_ptp_cfg *ptp);
|
||||
int bnxt_ptp_get_txts_prod(struct bnxt_ptp_cfg *ptp, u16 *prod);
|
||||
void bnxt_get_tx_ts_p5(struct bnxt *bp, struct sk_buff *skb, u16 prod);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user