mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
Merge tag 'net-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Jakub Kicinski:
"Including fixes from wifi, netfilter and can.
A handful of awaited fixes here - revert of the FEC changes, bluetooth
fix, fixes for iwlwifi spew.
We added a warning in PHY/MDIO code which is triggering on a couple of
platforms in a false-positive-ish way. If we can't iron that out over
the week we'll drop it and re-add for 6.1.
I've added a new "follow up fixes" section for fixes to fixes in
6.0-rcs but it may actually give the false impression that those are
problematic or that more testing time would have caught them. So
likely a one time thing.
Follow up fixes:
- nf_tables_addchain: fix nft_counters_enabled underflow
- ebtables: fix memory leak when blob is malformed
- nf_ct_ftp: fix deadlock when nat rewrite is needed
Current release - regressions:
- Revert "fec: Restart PPS after link state change" and the related
"net: fec: Use a spinlock to guard `fep->ptp_clk_on`"
- Bluetooth: fix HCIGETDEVINFO regression
- wifi: mt76: fix 5 GHz connection regression on mt76x0/mt76x2
- mptcp: fix fwd memory accounting on coalesce
- rwlock removal fall out:
- ipmr: always call ip{,6}_mr_forward() from RCU read-side
critical section
- ipv6: fix crash when IPv6 is administratively disabled
- tcp: read multiple skbs in tcp_read_skb()
- mdio_bus_phy_resume state warning fallout:
- eth: ravb: fix PHY state warning splat during system resume
- eth: sh_eth: fix PHY state warning splat during system resume
Current release - new code bugs:
- wifi: iwlwifi: don't spam logs with NSS>2 messages
- eth: mtk_eth_soc: enable XDP support just for MT7986 SoC
Previous releases - regressions:
- bonding: fix NULL deref in bond_rr_gen_slave_id
- wifi: iwlwifi: mark IWLMEI as broken
Previous releases - always broken:
- nf_conntrack helpers:
- irc: tighten matching on DCC message
- sip: fix ct_sip_walk_headers
- osf: fix possible bogus match in nf_osf_find()
- ipvlan: fix out-of-bound bugs caused by unset skb->mac_header
- core: fix flow symmetric hash
- bonding, team: unsync device addresses on ndo_stop
- phy: micrel: fix shared interrupt on LAN8814"
* tag 'net-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (83 commits)
selftests: forwarding: add shebang for sch_red.sh
bnxt: prevent skb UAF after handing over to PTP worker
net: marvell: Fix refcounting bugs in prestera_port_sfp_bind()
net: sched: fix possible refcount leak in tc_new_tfilter()
net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD
udp: Use WARN_ON_ONCE() in udp_read_skb()
selftests: bonding: cause oops in bond_rr_gen_slave_id
bonding: fix NULL deref in bond_rr_gen_slave_id
net: phy: micrel: fix shared interrupt on LAN8814
net/smc: Stop the CLC flow if no link to map buffers on
ice: Fix ice_xdp_xmit() when XDP TX queue number is not sufficient
net: atlantic: fix potential memory leak in aq_ndev_close()
can: gs_usb: gs_usb_set_phys_id(): return with error if identify is not supported
can: gs_usb: gs_can_open(): fix race dev->can.state condition
can: flexcan: flexcan_mailbox_read() fix return value for drop = true
net: sh_eth: Fix PHY state warning splat during system resume
net: ravb: Fix PHY state warning splat during system resume
netfilter: nf_ct_ftp: fix deadlock when nat rewrite is needed
netfilter: ebtables: fix memory leak when blob is malformed
netfilter: nf_tables: fix percpu memory leak at nf_tables_addchain()
...
This commit is contained in:
@@ -47,7 +47,6 @@ allow_join_initial_addr_port - BOOLEAN
|
||||
Default: 1
|
||||
|
||||
pm_type - INTEGER
|
||||
|
||||
Set the default path manager type to use for each new MPTCP
|
||||
socket. In-kernel path management will control subflow
|
||||
connections and address advertisements according to
|
||||
|
||||
@@ -70,15 +70,6 @@ nf_conntrack_generic_timeout - INTEGER (seconds)
|
||||
Default for generic timeout. This refers to layer 4 unknown/unsupported
|
||||
protocols.
|
||||
|
||||
nf_conntrack_helper - BOOLEAN
|
||||
- 0 - disabled (default)
|
||||
- not 0 - enabled
|
||||
|
||||
Enable automatic conntrack helper assignment.
|
||||
If disabled it is required to set up iptables rules to assign
|
||||
helpers to connections. See the CT target description in the
|
||||
iptables-extensions(8) man page for further information.
|
||||
|
||||
nf_conntrack_icmp_timeout - INTEGER (seconds)
|
||||
default 30
|
||||
|
||||
|
||||
@@ -8652,8 +8652,8 @@ F: drivers/input/touchscreen/goodix*
|
||||
|
||||
GOOGLE ETHERNET DRIVERS
|
||||
M: Jeroen de Borst <jeroendb@google.com>
|
||||
R: Catherine Sullivan <csully@google.com>
|
||||
R: David Awogbemila <awogbemila@google.com>
|
||||
M: Catherine Sullivan <csully@google.com>
|
||||
R: Shailend Chand <shailend@google.com>
|
||||
L: netdev@vger.kernel.org
|
||||
S: Supported
|
||||
F: Documentation/networking/device_drivers/ethernet/google/gve.rst
|
||||
@@ -16857,6 +16857,7 @@ F: drivers/net/ethernet/qualcomm/emac/
|
||||
|
||||
QUALCOMM ETHQOS ETHERNET DRIVER
|
||||
M: Vinod Koul <vkoul@kernel.org>
|
||||
R: Bhupesh Sharma <bhupesh.sharma@linaro.org>
|
||||
L: netdev@vger.kernel.org
|
||||
S: Maintained
|
||||
F: Documentation/devicetree/bindings/net/qcom,ethqos.txt
|
||||
@@ -19959,6 +19960,7 @@ S: Supported
|
||||
F: drivers/net/team/
|
||||
F: include/linux/if_team.h
|
||||
F: include/uapi/linux/if_team.h
|
||||
F: tools/testing/selftests/net/team/
|
||||
|
||||
TECHNOLOGIC SYSTEMS TS-5500 PLATFORM SUPPORT
|
||||
M: "Savoir-faire Linux Inc." <kernel@savoirfairelinux.com>
|
||||
|
||||
@@ -88,8 +88,9 @@ static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = {
|
||||
static const u16 ad_ticks_per_sec = 1000 / AD_TIMER_INTERVAL;
|
||||
static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000;
|
||||
|
||||
static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned =
|
||||
MULTICAST_LACPDU_ADDR;
|
||||
const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = {
|
||||
0x01, 0x80, 0xC2, 0x00, 0x00, 0x02
|
||||
};
|
||||
|
||||
/* ================= main 802.3ad protocol functions ================== */
|
||||
static int ad_lacpdu_send(struct port *port);
|
||||
|
||||
@@ -865,12 +865,8 @@ static void bond_hw_addr_flush(struct net_device *bond_dev,
|
||||
dev_uc_unsync(slave_dev, bond_dev);
|
||||
dev_mc_unsync(slave_dev, bond_dev);
|
||||
|
||||
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
|
||||
/* del lacpdu mc addr from mc list */
|
||||
u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
|
||||
|
||||
dev_mc_del(slave_dev, lacpdu_multicast);
|
||||
}
|
||||
if (BOND_MODE(bond) == BOND_MODE_8023AD)
|
||||
dev_mc_del(slave_dev, lacpdu_mcast_addr);
|
||||
}
|
||||
|
||||
/*--------------------------- Active slave change ---------------------------*/
|
||||
@@ -890,7 +886,8 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,
|
||||
if (bond->dev->flags & IFF_ALLMULTI)
|
||||
dev_set_allmulti(old_active->dev, -1);
|
||||
|
||||
bond_hw_addr_flush(bond->dev, old_active->dev);
|
||||
if (bond->dev->flags & IFF_UP)
|
||||
bond_hw_addr_flush(bond->dev, old_active->dev);
|
||||
}
|
||||
|
||||
if (new_active) {
|
||||
@@ -901,10 +898,12 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,
|
||||
if (bond->dev->flags & IFF_ALLMULTI)
|
||||
dev_set_allmulti(new_active->dev, 1);
|
||||
|
||||
netif_addr_lock_bh(bond->dev);
|
||||
dev_uc_sync(new_active->dev, bond->dev);
|
||||
dev_mc_sync(new_active->dev, bond->dev);
|
||||
netif_addr_unlock_bh(bond->dev);
|
||||
if (bond->dev->flags & IFF_UP) {
|
||||
netif_addr_lock_bh(bond->dev);
|
||||
dev_uc_sync(new_active->dev, bond->dev);
|
||||
dev_mc_sync(new_active->dev, bond->dev);
|
||||
netif_addr_unlock_bh(bond->dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2166,16 +2165,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
|
||||
}
|
||||
}
|
||||
|
||||
netif_addr_lock_bh(bond_dev);
|
||||
dev_mc_sync_multiple(slave_dev, bond_dev);
|
||||
dev_uc_sync_multiple(slave_dev, bond_dev);
|
||||
netif_addr_unlock_bh(bond_dev);
|
||||
if (bond_dev->flags & IFF_UP) {
|
||||
netif_addr_lock_bh(bond_dev);
|
||||
dev_mc_sync_multiple(slave_dev, bond_dev);
|
||||
dev_uc_sync_multiple(slave_dev, bond_dev);
|
||||
netif_addr_unlock_bh(bond_dev);
|
||||
|
||||
if (BOND_MODE(bond) == BOND_MODE_8023AD) {
|
||||
/* add lacpdu mc addr to mc list */
|
||||
u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
|
||||
|
||||
dev_mc_add(slave_dev, lacpdu_multicast);
|
||||
if (BOND_MODE(bond) == BOND_MODE_8023AD)
|
||||
dev_mc_add(slave_dev, lacpdu_mcast_addr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2447,7 +2444,8 @@ static int __bond_release_one(struct net_device *bond_dev,
|
||||
if (old_flags & IFF_ALLMULTI)
|
||||
dev_set_allmulti(slave_dev, -1);
|
||||
|
||||
bond_hw_addr_flush(bond_dev, slave_dev);
|
||||
if (old_flags & IFF_UP)
|
||||
bond_hw_addr_flush(bond_dev, slave_dev);
|
||||
}
|
||||
|
||||
slave_disable_netpoll(slave);
|
||||
@@ -4184,6 +4182,12 @@ static int bond_open(struct net_device *bond_dev)
|
||||
struct list_head *iter;
|
||||
struct slave *slave;
|
||||
|
||||
if (BOND_MODE(bond) == BOND_MODE_ROUNDROBIN && !bond->rr_tx_counter) {
|
||||
bond->rr_tx_counter = alloc_percpu(u32);
|
||||
if (!bond->rr_tx_counter)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* reset slave->backup and slave->inactive */
|
||||
if (bond_has_slaves(bond)) {
|
||||
bond_for_each_slave(bond, slave, iter) {
|
||||
@@ -4221,6 +4225,9 @@ static int bond_open(struct net_device *bond_dev)
|
||||
/* register to receive LACPDUs */
|
||||
bond->recv_probe = bond_3ad_lacpdu_recv;
|
||||
bond_3ad_initiate_agg_selection(bond, 1);
|
||||
|
||||
bond_for_each_slave(bond, slave, iter)
|
||||
dev_mc_add(slave->dev, lacpdu_mcast_addr);
|
||||
}
|
||||
|
||||
if (bond_mode_can_use_xmit_hash(bond))
|
||||
@@ -4232,6 +4239,7 @@ static int bond_open(struct net_device *bond_dev)
|
||||
static int bond_close(struct net_device *bond_dev)
|
||||
{
|
||||
struct bonding *bond = netdev_priv(bond_dev);
|
||||
struct slave *slave;
|
||||
|
||||
bond_work_cancel_all(bond);
|
||||
bond->send_peer_notif = 0;
|
||||
@@ -4239,6 +4247,19 @@ static int bond_close(struct net_device *bond_dev)
|
||||
bond_alb_deinitialize(bond);
|
||||
bond->recv_probe = NULL;
|
||||
|
||||
if (bond_uses_primary(bond)) {
|
||||
rcu_read_lock();
|
||||
slave = rcu_dereference(bond->curr_active_slave);
|
||||
if (slave)
|
||||
bond_hw_addr_flush(bond_dev, slave->dev);
|
||||
rcu_read_unlock();
|
||||
} else {
|
||||
struct list_head *iter;
|
||||
|
||||
bond_for_each_slave(bond, slave, iter)
|
||||
bond_hw_addr_flush(bond_dev, slave->dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6228,15 +6249,6 @@ static int bond_init(struct net_device *bond_dev)
|
||||
if (!bond->wq)
|
||||
return -ENOMEM;
|
||||
|
||||
if (BOND_MODE(bond) == BOND_MODE_ROUNDROBIN) {
|
||||
bond->rr_tx_counter = alloc_percpu(u32);
|
||||
if (!bond->rr_tx_counter) {
|
||||
destroy_workqueue(bond->wq);
|
||||
bond->wq = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
spin_lock_init(&bond->stats_lock);
|
||||
netdev_lockdep_set_classes(bond_dev);
|
||||
|
||||
|
||||
@@ -941,11 +941,6 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload,
|
||||
u32 reg_ctrl, reg_id, reg_iflag1;
|
||||
int i;
|
||||
|
||||
if (unlikely(drop)) {
|
||||
skb = ERR_PTR(-ENOBUFS);
|
||||
goto mark_as_read;
|
||||
}
|
||||
|
||||
mb = flexcan_get_mb(priv, n);
|
||||
|
||||
if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) {
|
||||
@@ -974,6 +969,11 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload,
|
||||
reg_ctrl = priv->read(&mb->can_ctrl);
|
||||
}
|
||||
|
||||
if (unlikely(drop)) {
|
||||
skb = ERR_PTR(-ENOBUFS);
|
||||
goto mark_as_read;
|
||||
}
|
||||
|
||||
if (reg_ctrl & FLEXCAN_MB_CNT_EDL)
|
||||
skb = alloc_canfd_skb(offload->dev, &cfd);
|
||||
else
|
||||
|
||||
@@ -824,6 +824,7 @@ static int gs_can_open(struct net_device *netdev)
|
||||
flags |= GS_CAN_MODE_TRIPLE_SAMPLE;
|
||||
|
||||
/* finally start device */
|
||||
dev->can.state = CAN_STATE_ERROR_ACTIVE;
|
||||
dm->mode = cpu_to_le32(GS_CAN_MODE_START);
|
||||
dm->flags = cpu_to_le32(flags);
|
||||
rc = usb_control_msg(interface_to_usbdev(dev->iface),
|
||||
@@ -835,13 +836,12 @@ static int gs_can_open(struct net_device *netdev)
|
||||
if (rc < 0) {
|
||||
netdev_err(netdev, "Couldn't start device (err=%d)\n", rc);
|
||||
kfree(dm);
|
||||
dev->can.state = CAN_STATE_STOPPED;
|
||||
return rc;
|
||||
}
|
||||
|
||||
kfree(dm);
|
||||
|
||||
dev->can.state = CAN_STATE_ERROR_ACTIVE;
|
||||
|
||||
parent->active_channels++;
|
||||
if (!(dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY))
|
||||
netif_start_queue(netdev);
|
||||
@@ -925,17 +925,21 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify)
|
||||
}
|
||||
|
||||
/* blink LED's for finding the this interface */
|
||||
static int gs_usb_set_phys_id(struct net_device *dev,
|
||||
static int gs_usb_set_phys_id(struct net_device *netdev,
|
||||
enum ethtool_phys_id_state state)
|
||||
{
|
||||
const struct gs_can *dev = netdev_priv(netdev);
|
||||
int rc = 0;
|
||||
|
||||
if (!(dev->feature & GS_CAN_FEATURE_IDENTIFY))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
switch (state) {
|
||||
case ETHTOOL_ID_ACTIVE:
|
||||
rc = gs_usb_set_identify(dev, GS_CAN_IDENTIFY_ON);
|
||||
rc = gs_usb_set_identify(netdev, GS_CAN_IDENTIFY_ON);
|
||||
break;
|
||||
case ETHTOOL_ID_INACTIVE:
|
||||
rc = gs_usb_set_identify(dev, GS_CAN_IDENTIFY_OFF);
|
||||
rc = gs_usb_set_identify(netdev, GS_CAN_IDENTIFY_OFF);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1072,9 +1076,10 @@ static struct gs_can *gs_make_candev(unsigned int channel,
|
||||
dev->feature |= GS_CAN_FEATURE_REQ_USB_QUIRK_LPC546XX |
|
||||
GS_CAN_FEATURE_QUIRK_BREQ_CANTACT_PRO;
|
||||
|
||||
if (le32_to_cpu(dconf->sw_version) > 1)
|
||||
if (feature & GS_CAN_FEATURE_IDENTIFY)
|
||||
netdev->ethtool_ops = &gs_usb_ethtool_ops;
|
||||
/* GS_CAN_FEATURE_IDENTIFY is only supported for sw_version > 1 */
|
||||
if (!(le32_to_cpu(dconf->sw_version) > 1 &&
|
||||
feature & GS_CAN_FEATURE_IDENTIFY))
|
||||
dev->feature &= ~GS_CAN_FEATURE_IDENTIFY;
|
||||
|
||||
kfree(bt_const);
|
||||
|
||||
|
||||
@@ -244,10 +244,6 @@ void lan937x_port_setup(struct ksz_device *dev, int port, bool cpu_port)
|
||||
lan937x_port_cfg(dev, port, REG_PORT_CTRL_0,
|
||||
PORT_TAIL_TAG_ENABLE, true);
|
||||
|
||||
/* disable frame check length field */
|
||||
lan937x_port_cfg(dev, port, REG_PORT_MAC_CTRL_0, PORT_CHECK_LENGTH,
|
||||
false);
|
||||
|
||||
/* set back pressure for half duplex */
|
||||
lan937x_port_cfg(dev, port, REG_PORT_MAC_CTRL_1, PORT_BACK_PRESSURE,
|
||||
true);
|
||||
|
||||
@@ -94,11 +94,8 @@ static int aq_ndev_close(struct net_device *ndev)
|
||||
int err = 0;
|
||||
|
||||
err = aq_nic_stop(aq_nic);
|
||||
if (err < 0)
|
||||
goto err_exit;
|
||||
aq_nic_deinit(aq_nic, true);
|
||||
|
||||
err_exit:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@@ -659,7 +659,6 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
|
||||
|
||||
for (i = 0; i < nr_pkts; i++) {
|
||||
struct bnxt_sw_tx_bd *tx_buf;
|
||||
bool compl_deferred = false;
|
||||
struct sk_buff *skb;
|
||||
int j, last;
|
||||
|
||||
@@ -668,6 +667,8 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
|
||||
skb = tx_buf->skb;
|
||||
tx_buf->skb = NULL;
|
||||
|
||||
tx_bytes += skb->len;
|
||||
|
||||
if (tx_buf->is_push) {
|
||||
tx_buf->is_push = 0;
|
||||
goto next_tx_int;
|
||||
@@ -688,8 +689,9 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
|
||||
}
|
||||
if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) {
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
/* PTP worker takes ownership of the skb */
|
||||
if (!bnxt_get_tx_ts_p5(bp, skb))
|
||||
compl_deferred = true;
|
||||
skb = NULL;
|
||||
else
|
||||
atomic_inc(&bp->ptp_cfg->tx_avail);
|
||||
}
|
||||
@@ -698,9 +700,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
|
||||
next_tx_int:
|
||||
cons = NEXT_TX(cons);
|
||||
|
||||
tx_bytes += skb->len;
|
||||
if (!compl_deferred)
|
||||
dev_kfree_skb_any(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
|
||||
netdev_tx_completed_queue(txq, nr_pkts, tx_bytes);
|
||||
|
||||
@@ -317,9 +317,9 @@ void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp)
|
||||
|
||||
if (!(bp->fw_cap & BNXT_FW_CAP_RX_ALL_PKT_TS) && (ptp->tstamp_filters &
|
||||
(PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE |
|
||||
PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE))) {
|
||||
PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE))) {
|
||||
ptp->tstamp_filters &= ~(PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE |
|
||||
PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE);
|
||||
PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE);
|
||||
netdev_warn(bp->dev, "Unsupported FW for all RX pkts timestamp filter\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ fsl-enetc-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o
|
||||
|
||||
obj-$(CONFIG_FSL_ENETC_VF) += fsl-enetc-vf.o
|
||||
fsl-enetc-vf-y := enetc_vf.o $(common-objs)
|
||||
fsl-enetc-vf-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o
|
||||
|
||||
obj-$(CONFIG_FSL_ENETC_IERB) += fsl-enetc-ierb.o
|
||||
fsl-enetc-ierb-y := enetc_ierb.o
|
||||
|
||||
@@ -2432,7 +2432,7 @@ int enetc_close(struct net_device *ndev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)
|
||||
int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)
|
||||
{
|
||||
struct enetc_ndev_priv *priv = netdev_priv(ndev);
|
||||
struct tc_mqprio_qopt *mqprio = type_data;
|
||||
@@ -2486,25 +2486,6 @@ static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type,
|
||||
void *type_data)
|
||||
{
|
||||
switch (type) {
|
||||
case TC_SETUP_QDISC_MQPRIO:
|
||||
return enetc_setup_tc_mqprio(ndev, type_data);
|
||||
case TC_SETUP_QDISC_TAPRIO:
|
||||
return enetc_setup_tc_taprio(ndev, type_data);
|
||||
case TC_SETUP_QDISC_CBS:
|
||||
return enetc_setup_tc_cbs(ndev, type_data);
|
||||
case TC_SETUP_QDISC_ETF:
|
||||
return enetc_setup_tc_txtime(ndev, type_data);
|
||||
case TC_SETUP_BLOCK:
|
||||
return enetc_setup_tc_psfp(ndev, type_data);
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
|
||||
static int enetc_setup_xdp_prog(struct net_device *dev, struct bpf_prog *prog,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
@@ -2600,29 +2581,6 @@ static int enetc_set_rss(struct net_device *ndev, int en)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int enetc_set_psfp(struct net_device *ndev, int en)
|
||||
{
|
||||
struct enetc_ndev_priv *priv = netdev_priv(ndev);
|
||||
int err;
|
||||
|
||||
if (en) {
|
||||
err = enetc_psfp_enable(priv);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
priv->active_offloads |= ENETC_F_QCI;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = enetc_psfp_disable(priv);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
priv->active_offloads &= ~ENETC_F_QCI;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void enetc_enable_rxvlan(struct net_device *ndev, bool en)
|
||||
{
|
||||
struct enetc_ndev_priv *priv = netdev_priv(ndev);
|
||||
@@ -2641,11 +2599,9 @@ static void enetc_enable_txvlan(struct net_device *ndev, bool en)
|
||||
enetc_bdr_enable_txvlan(&priv->si->hw, i, en);
|
||||
}
|
||||
|
||||
int enetc_set_features(struct net_device *ndev,
|
||||
netdev_features_t features)
|
||||
void enetc_set_features(struct net_device *ndev, netdev_features_t features)
|
||||
{
|
||||
netdev_features_t changed = ndev->features ^ features;
|
||||
int err = 0;
|
||||
|
||||
if (changed & NETIF_F_RXHASH)
|
||||
enetc_set_rss(ndev, !!(features & NETIF_F_RXHASH));
|
||||
@@ -2657,11 +2613,6 @@ int enetc_set_features(struct net_device *ndev,
|
||||
if (changed & NETIF_F_HW_VLAN_CTAG_TX)
|
||||
enetc_enable_txvlan(ndev,
|
||||
!!(features & NETIF_F_HW_VLAN_CTAG_TX));
|
||||
|
||||
if (changed & NETIF_F_HW_TC)
|
||||
err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC));
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_FSL_ENETC_PTP_CLOCK
|
||||
|
||||
@@ -393,11 +393,9 @@ void enetc_start(struct net_device *ndev);
|
||||
void enetc_stop(struct net_device *ndev);
|
||||
netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev);
|
||||
struct net_device_stats *enetc_get_stats(struct net_device *ndev);
|
||||
int enetc_set_features(struct net_device *ndev,
|
||||
netdev_features_t features);
|
||||
void enetc_set_features(struct net_device *ndev, netdev_features_t features);
|
||||
int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd);
|
||||
int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type,
|
||||
void *type_data);
|
||||
int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data);
|
||||
int enetc_setup_bpf(struct net_device *dev, struct netdev_bpf *xdp);
|
||||
int enetc_xdp_xmit(struct net_device *ndev, int num_frames,
|
||||
struct xdp_frame **frames, u32 flags);
|
||||
@@ -465,6 +463,7 @@ int enetc_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
|
||||
int enetc_setup_tc_psfp(struct net_device *ndev, void *type_data);
|
||||
int enetc_psfp_init(struct enetc_ndev_priv *priv);
|
||||
int enetc_psfp_clean(struct enetc_ndev_priv *priv);
|
||||
int enetc_set_psfp(struct net_device *ndev, bool en);
|
||||
|
||||
static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv)
|
||||
{
|
||||
@@ -540,4 +539,9 @@ static inline int enetc_psfp_disable(struct enetc_ndev_priv *priv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int enetc_set_psfp(struct net_device *ndev, bool en)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -709,6 +709,13 @@ static int enetc_pf_set_features(struct net_device *ndev,
|
||||
{
|
||||
netdev_features_t changed = ndev->features ^ features;
|
||||
struct enetc_ndev_priv *priv = netdev_priv(ndev);
|
||||
int err;
|
||||
|
||||
if (changed & NETIF_F_HW_TC) {
|
||||
err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC));
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) {
|
||||
struct enetc_pf *pf = enetc_si_priv(priv->si);
|
||||
@@ -722,7 +729,28 @@ static int enetc_pf_set_features(struct net_device *ndev,
|
||||
if (changed & NETIF_F_LOOPBACK)
|
||||
enetc_set_loopback(ndev, !!(features & NETIF_F_LOOPBACK));
|
||||
|
||||
return enetc_set_features(ndev, features);
|
||||
enetc_set_features(ndev, features);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int enetc_pf_setup_tc(struct net_device *ndev, enum tc_setup_type type,
|
||||
void *type_data)
|
||||
{
|
||||
switch (type) {
|
||||
case TC_SETUP_QDISC_MQPRIO:
|
||||
return enetc_setup_tc_mqprio(ndev, type_data);
|
||||
case TC_SETUP_QDISC_TAPRIO:
|
||||
return enetc_setup_tc_taprio(ndev, type_data);
|
||||
case TC_SETUP_QDISC_CBS:
|
||||
return enetc_setup_tc_cbs(ndev, type_data);
|
||||
case TC_SETUP_QDISC_ETF:
|
||||
return enetc_setup_tc_txtime(ndev, type_data);
|
||||
case TC_SETUP_BLOCK:
|
||||
return enetc_setup_tc_psfp(ndev, type_data);
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct net_device_ops enetc_ndev_ops = {
|
||||
@@ -739,7 +767,7 @@ static const struct net_device_ops enetc_ndev_ops = {
|
||||
.ndo_set_vf_spoofchk = enetc_pf_set_vf_spoofchk,
|
||||
.ndo_set_features = enetc_pf_set_features,
|
||||
.ndo_eth_ioctl = enetc_ioctl,
|
||||
.ndo_setup_tc = enetc_setup_tc,
|
||||
.ndo_setup_tc = enetc_pf_setup_tc,
|
||||
.ndo_bpf = enetc_setup_bpf,
|
||||
.ndo_xdp_xmit = enetc_xdp_xmit,
|
||||
};
|
||||
|
||||
@@ -1517,6 +1517,29 @@ int enetc_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
|
||||
}
|
||||
}
|
||||
|
||||
int enetc_set_psfp(struct net_device *ndev, bool en)
|
||||
{
|
||||
struct enetc_ndev_priv *priv = netdev_priv(ndev);
|
||||
int err;
|
||||
|
||||
if (en) {
|
||||
err = enetc_psfp_enable(priv);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
priv->active_offloads |= ENETC_F_QCI;
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = enetc_psfp_disable(priv);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
priv->active_offloads &= ~ENETC_F_QCI;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int enetc_psfp_init(struct enetc_ndev_priv *priv)
|
||||
{
|
||||
if (epsfp.psfp_sfi_bitmap)
|
||||
|
||||
@@ -88,7 +88,20 @@ static int enetc_vf_set_mac_addr(struct net_device *ndev, void *addr)
|
||||
static int enetc_vf_set_features(struct net_device *ndev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
return enetc_set_features(ndev, features);
|
||||
enetc_set_features(ndev, features);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int enetc_vf_setup_tc(struct net_device *ndev, enum tc_setup_type type,
|
||||
void *type_data)
|
||||
{
|
||||
switch (type) {
|
||||
case TC_SETUP_QDISC_MQPRIO:
|
||||
return enetc_setup_tc_mqprio(ndev, type_data);
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
}
|
||||
|
||||
/* Probing/ Init */
|
||||
@@ -100,7 +113,7 @@ static const struct net_device_ops enetc_ndev_ops = {
|
||||
.ndo_set_mac_address = enetc_vf_set_mac_addr,
|
||||
.ndo_set_features = enetc_vf_set_features,
|
||||
.ndo_eth_ioctl = enetc_ioctl,
|
||||
.ndo_setup_tc = enetc_setup_tc,
|
||||
.ndo_setup_tc = enetc_vf_setup_tc,
|
||||
};
|
||||
|
||||
static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
|
||||
|
||||
@@ -561,6 +561,7 @@ struct fec_enet_private {
|
||||
struct clk *clk_2x_txclk;
|
||||
|
||||
bool ptp_clk_on;
|
||||
struct mutex ptp_clk_mutex;
|
||||
unsigned int num_tx_queues;
|
||||
unsigned int num_rx_queues;
|
||||
|
||||
@@ -638,13 +639,6 @@ struct fec_enet_private {
|
||||
int pps_enable;
|
||||
unsigned int next_counter;
|
||||
|
||||
struct {
|
||||
struct timespec64 ts_phc;
|
||||
u64 ns_sys;
|
||||
u32 at_corr;
|
||||
u8 at_inc_corr;
|
||||
} ptp_saved_state;
|
||||
|
||||
u64 ethtool_stats[];
|
||||
};
|
||||
|
||||
@@ -655,8 +649,5 @@ void fec_ptp_disable_hwts(struct net_device *ndev);
|
||||
int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr);
|
||||
int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr);
|
||||
|
||||
void fec_ptp_save_state(struct fec_enet_private *fep);
|
||||
int fec_ptp_restore_state(struct fec_enet_private *fep);
|
||||
|
||||
/****************************************************************************/
|
||||
#endif /* FEC_H */
|
||||
|
||||
@@ -286,11 +286,8 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
|
||||
#define FEC_MMFR_TA (2 << 16)
|
||||
#define FEC_MMFR_DATA(v) (v & 0xffff)
|
||||
/* FEC ECR bits definition */
|
||||
#define FEC_ECR_RESET BIT(0)
|
||||
#define FEC_ECR_ETHEREN BIT(1)
|
||||
#define FEC_ECR_MAGICEN BIT(2)
|
||||
#define FEC_ECR_SLEEP BIT(3)
|
||||
#define FEC_ECR_EN1588 BIT(4)
|
||||
#define FEC_ECR_MAGICEN (1 << 2)
|
||||
#define FEC_ECR_SLEEP (1 << 3)
|
||||
|
||||
#define FEC_MII_TIMEOUT 30000 /* us */
|
||||
|
||||
@@ -986,9 +983,6 @@ fec_restart(struct net_device *ndev)
|
||||
u32 temp_mac[2];
|
||||
u32 rcntl = OPT_FRAME_SIZE | 0x04;
|
||||
u32 ecntl = 0x2; /* ETHEREN */
|
||||
struct ptp_clock_request ptp_rq = { .type = PTP_CLK_REQ_PPS };
|
||||
|
||||
fec_ptp_save_state(fep);
|
||||
|
||||
/* Whack a reset. We should wait for this.
|
||||
* For i.MX6SX SOC, enet use AXI bus, we use disable MAC
|
||||
@@ -1142,7 +1136,7 @@ fec_restart(struct net_device *ndev)
|
||||
}
|
||||
|
||||
if (fep->bufdesc_ex)
|
||||
ecntl |= FEC_ECR_EN1588;
|
||||
ecntl |= (1 << 4);
|
||||
|
||||
if (fep->quirks & FEC_QUIRK_DELAYED_CLKS_SUPPORT &&
|
||||
fep->rgmii_txc_dly)
|
||||
@@ -1163,14 +1157,6 @@ fec_restart(struct net_device *ndev)
|
||||
if (fep->bufdesc_ex)
|
||||
fec_ptp_start_cyclecounter(ndev);
|
||||
|
||||
/* Restart PPS if needed */
|
||||
if (fep->pps_enable) {
|
||||
/* Clear flag so fec_ptp_enable_pps() doesn't return immediately */
|
||||
fep->pps_enable = 0;
|
||||
fec_ptp_restore_state(fep);
|
||||
fep->ptp_caps.enable(&fep->ptp_caps, &ptp_rq, 1);
|
||||
}
|
||||
|
||||
/* Enable interrupts we wish to service */
|
||||
if (fep->link)
|
||||
writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
|
||||
@@ -1221,8 +1207,6 @@ fec_stop(struct net_device *ndev)
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & (1 << 8);
|
||||
u32 val;
|
||||
struct ptp_clock_request ptp_rq = { .type = PTP_CLK_REQ_PPS };
|
||||
u32 ecntl = 0;
|
||||
|
||||
/* We cannot expect a graceful transmit stop without link !!! */
|
||||
if (fep->link) {
|
||||
@@ -1232,8 +1216,6 @@ fec_stop(struct net_device *ndev)
|
||||
netdev_err(ndev, "Graceful transmit stop did not complete!\n");
|
||||
}
|
||||
|
||||
fec_ptp_save_state(fep);
|
||||
|
||||
/* Whack a reset. We should wait for this.
|
||||
* For i.MX6SX SOC, enet use AXI bus, we use disable MAC
|
||||
* instead of reset MAC itself.
|
||||
@@ -1253,28 +1235,12 @@ fec_stop(struct net_device *ndev)
|
||||
writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
|
||||
writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
|
||||
|
||||
if (fep->bufdesc_ex)
|
||||
ecntl |= FEC_ECR_EN1588;
|
||||
|
||||
/* We have to keep ENET enabled to have MII interrupt stay working */
|
||||
if (fep->quirks & FEC_QUIRK_ENET_MAC &&
|
||||
!(fep->wol_flag & FEC_WOL_FLAG_SLEEP_ON)) {
|
||||
ecntl |= FEC_ECR_ETHEREN;
|
||||
writel(2, fep->hwp + FEC_ECNTRL);
|
||||
writel(rmii_mode, fep->hwp + FEC_R_CNTRL);
|
||||
}
|
||||
|
||||
writel(ecntl, fep->hwp + FEC_ECNTRL);
|
||||
|
||||
if (fep->bufdesc_ex)
|
||||
fec_ptp_start_cyclecounter(ndev);
|
||||
|
||||
/* Restart PPS if needed */
|
||||
if (fep->pps_enable) {
|
||||
/* Clear flag so fec_ptp_enable_pps() doesn't return immediately */
|
||||
fep->pps_enable = 0;
|
||||
fec_ptp_restore_state(fep);
|
||||
fep->ptp_caps.enable(&fep->ptp_caps, &ptp_rq, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2029,7 +1995,6 @@ static void fec_enet_phy_reset_after_clk_enable(struct net_device *ndev)
|
||||
static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
|
||||
{
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
if (enable) {
|
||||
@@ -2038,15 +2003,15 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
|
||||
return ret;
|
||||
|
||||
if (fep->clk_ptp) {
|
||||
spin_lock_irqsave(&fep->tmreg_lock, flags);
|
||||
mutex_lock(&fep->ptp_clk_mutex);
|
||||
ret = clk_prepare_enable(fep->clk_ptp);
|
||||
if (ret) {
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
mutex_unlock(&fep->ptp_clk_mutex);
|
||||
goto failed_clk_ptp;
|
||||
} else {
|
||||
fep->ptp_clk_on = true;
|
||||
}
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
mutex_unlock(&fep->ptp_clk_mutex);
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(fep->clk_ref);
|
||||
@@ -2061,10 +2026,10 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
|
||||
} else {
|
||||
clk_disable_unprepare(fep->clk_enet_out);
|
||||
if (fep->clk_ptp) {
|
||||
spin_lock_irqsave(&fep->tmreg_lock, flags);
|
||||
mutex_lock(&fep->ptp_clk_mutex);
|
||||
clk_disable_unprepare(fep->clk_ptp);
|
||||
fep->ptp_clk_on = false;
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
mutex_unlock(&fep->ptp_clk_mutex);
|
||||
}
|
||||
clk_disable_unprepare(fep->clk_ref);
|
||||
clk_disable_unprepare(fep->clk_2x_txclk);
|
||||
@@ -2077,10 +2042,10 @@ failed_clk_2x_txclk:
|
||||
clk_disable_unprepare(fep->clk_ref);
|
||||
failed_clk_ref:
|
||||
if (fep->clk_ptp) {
|
||||
spin_lock_irqsave(&fep->tmreg_lock, flags);
|
||||
mutex_lock(&fep->ptp_clk_mutex);
|
||||
clk_disable_unprepare(fep->clk_ptp);
|
||||
fep->ptp_clk_on = false;
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
mutex_unlock(&fep->ptp_clk_mutex);
|
||||
}
|
||||
failed_clk_ptp:
|
||||
clk_disable_unprepare(fep->clk_enet_out);
|
||||
@@ -3915,7 +3880,7 @@ fec_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
fep->ptp_clk_on = false;
|
||||
spin_lock_init(&fep->tmreg_lock);
|
||||
mutex_init(&fep->ptp_clk_mutex);
|
||||
|
||||
/* clk_ref is optional, depends on board */
|
||||
fep->clk_ref = devm_clk_get_optional(&pdev->dev, "enet_clk_ref");
|
||||
|
||||
@@ -365,19 +365,21 @@ static int fec_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
|
||||
*/
|
||||
static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
|
||||
{
|
||||
struct fec_enet_private *fep =
|
||||
struct fec_enet_private *adapter =
|
||||
container_of(ptp, struct fec_enet_private, ptp_caps);
|
||||
u64 ns;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&fep->tmreg_lock, flags);
|
||||
mutex_lock(&adapter->ptp_clk_mutex);
|
||||
/* Check the ptp clock */
|
||||
if (!fep->ptp_clk_on) {
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
if (!adapter->ptp_clk_on) {
|
||||
mutex_unlock(&adapter->ptp_clk_mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
ns = timecounter_read(&fep->tc);
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
spin_lock_irqsave(&adapter->tmreg_lock, flags);
|
||||
ns = timecounter_read(&adapter->tc);
|
||||
spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
|
||||
mutex_unlock(&adapter->ptp_clk_mutex);
|
||||
|
||||
*ts = ns_to_timespec64(ns);
|
||||
|
||||
@@ -402,10 +404,10 @@ static int fec_ptp_settime(struct ptp_clock_info *ptp,
|
||||
unsigned long flags;
|
||||
u32 counter;
|
||||
|
||||
spin_lock_irqsave(&fep->tmreg_lock, flags);
|
||||
mutex_lock(&fep->ptp_clk_mutex);
|
||||
/* Check the ptp clock */
|
||||
if (!fep->ptp_clk_on) {
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
mutex_unlock(&fep->ptp_clk_mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -415,9 +417,11 @@ static int fec_ptp_settime(struct ptp_clock_info *ptp,
|
||||
*/
|
||||
counter = ns & fep->cc.mask;
|
||||
|
||||
spin_lock_irqsave(&fep->tmreg_lock, flags);
|
||||
writel(counter, fep->hwp + FEC_ATIME);
|
||||
timecounter_init(&fep->tc, &fep->cc, ns);
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
mutex_unlock(&fep->ptp_clk_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -514,11 +518,13 @@ static void fec_time_keep(struct work_struct *work)
|
||||
struct fec_enet_private *fep = container_of(dwork, struct fec_enet_private, time_keep);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&fep->tmreg_lock, flags);
|
||||
mutex_lock(&fep->ptp_clk_mutex);
|
||||
if (fep->ptp_clk_on) {
|
||||
spin_lock_irqsave(&fep->tmreg_lock, flags);
|
||||
timecounter_read(&fep->tc);
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
}
|
||||
spin_unlock_irqrestore(&fep->tmreg_lock, flags);
|
||||
mutex_unlock(&fep->ptp_clk_mutex);
|
||||
|
||||
schedule_delayed_work(&fep->time_keep, HZ);
|
||||
}
|
||||
@@ -593,6 +599,8 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
|
||||
}
|
||||
fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed;
|
||||
|
||||
spin_lock_init(&fep->tmreg_lock);
|
||||
|
||||
fec_ptp_start_cyclecounter(ndev);
|
||||
|
||||
INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep);
|
||||
@@ -625,36 +633,7 @@ void fec_ptp_stop(struct platform_device *pdev)
|
||||
struct net_device *ndev = platform_get_drvdata(pdev);
|
||||
struct fec_enet_private *fep = netdev_priv(ndev);
|
||||
|
||||
if (fep->pps_enable)
|
||||
fec_ptp_enable_pps(fep, 0);
|
||||
|
||||
cancel_delayed_work_sync(&fep->time_keep);
|
||||
if (fep->ptp_clock)
|
||||
ptp_clock_unregister(fep->ptp_clock);
|
||||
}
|
||||
|
||||
void fec_ptp_save_state(struct fec_enet_private *fep)
|
||||
{
|
||||
u32 atime_inc_corr;
|
||||
|
||||
fec_ptp_gettime(&fep->ptp_caps, &fep->ptp_saved_state.ts_phc);
|
||||
fep->ptp_saved_state.ns_sys = ktime_get_ns();
|
||||
|
||||
fep->ptp_saved_state.at_corr = readl(fep->hwp + FEC_ATIME_CORR);
|
||||
atime_inc_corr = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_CORR_MASK;
|
||||
fep->ptp_saved_state.at_inc_corr = (u8)(atime_inc_corr >> FEC_T_INC_CORR_OFFSET);
|
||||
}
|
||||
|
||||
int fec_ptp_restore_state(struct fec_enet_private *fep)
|
||||
{
|
||||
u32 atime_inc = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_MASK;
|
||||
u64 ns_sys;
|
||||
|
||||
writel(fep->ptp_saved_state.at_corr, fep->hwp + FEC_ATIME_CORR);
|
||||
atime_inc |= ((u32)fep->ptp_saved_state.at_inc_corr) << FEC_T_INC_CORR_OFFSET;
|
||||
writel(atime_inc, fep->hwp + FEC_ATIME_INC);
|
||||
|
||||
ns_sys = ktime_get_ns() - fep->ptp_saved_state.ns_sys;
|
||||
timespec64_add_ns(&fep->ptp_saved_state.ts_phc, ns_sys);
|
||||
return fec_ptp_settime(&fep->ptp_caps, &fep->ptp_saved_state.ts_phc);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user