diff options
author | Yangbo Lu <yangbo.lu@nxp.com> | 2020-04-10 10:47:05 +0800 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-05-07 12:53:06 +0200 |
commit | cddd4591404fb4c53dc0b3c0b15b942cdbed4356 (patch) | |
tree | 392c1179de46b0f804e3789edca19069b64e6b44 /target/linux/layerscape/patches-5.4/701-net-0271-net-mscc-ocelot-use-skb-queue-instead-of-skbs-list.patch | |
parent | d1d2c0b5579ea4f69a42246c9318539d61ba1999 (diff) | |
download | upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.gz upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.tar.bz2 upstream-cddd4591404fb4c53dc0b3c0b15b942cdbed4356.zip |
layerscape: add patches-5.4
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release
which was tagged LSDK-20.04-V5.4.
https://source.codeaurora.org/external/qoriq/qoriq-components/linux/
For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in
LSDK, port the dts patches from 4.14.
The patches are sorted into the following categories:
301-arch-xxxx
302-dts-xxxx
303-core-xxxx
701-net-xxxx
801-audio-xxxx
802-can-xxxx
803-clock-xxxx
804-crypto-xxxx
805-display-xxxx
806-dma-xxxx
807-gpio-xxxx
808-i2c-xxxx
809-jailhouse-xxxx
810-keys-xxxx
811-kvm-xxxx
812-pcie-xxxx
813-pm-xxxx
814-qe-xxxx
815-sata-xxxx
816-sdhc-xxxx
817-spi-xxxx
818-thermal-xxxx
819-uart-xxxx
820-usb-xxxx
821-vfio-xxxx
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Diffstat (limited to 'target/linux/layerscape/patches-5.4/701-net-0271-net-mscc-ocelot-use-skb-queue-instead-of-skbs-list.patch')
-rw-r--r-- | target/linux/layerscape/patches-5.4/701-net-0271-net-mscc-ocelot-use-skb-queue-instead-of-skbs-list.patch | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/target/linux/layerscape/patches-5.4/701-net-0271-net-mscc-ocelot-use-skb-queue-instead-of-skbs-list.patch b/target/linux/layerscape/patches-5.4/701-net-0271-net-mscc-ocelot-use-skb-queue-instead-of-skbs-list.patch new file mode 100644 index 0000000000..6be37fcc72 --- /dev/null +++ b/target/linux/layerscape/patches-5.4/701-net-0271-net-mscc-ocelot-use-skb-queue-instead-of-skbs-list.patch @@ -0,0 +1,158 @@ +From e7e0b3b89da97e3186fbe3774a1ca9b77402d893 Mon Sep 17 00:00:00 2001 +From: Yangbo Lu <yangbo.lu@nxp.com> +Date: Wed, 27 Nov 2019 15:27:57 +0800 +Subject: [PATCH] net: mscc: ocelot: use skb queue instead of skbs list + +Convert to use skb queue instead of the list of skbs. +The skb queue could provide protection with lock. + +Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com> +Signed-off-by: David S. Miller <davem@davemloft.net> +--- + drivers/net/ethernet/mscc/ocelot.c | 54 +++++++++++++------------------------- + include/soc/mscc/ocelot.h | 9 +------ + 2 files changed, 19 insertions(+), 44 deletions(-) + +--- a/drivers/net/ethernet/mscc/ocelot.c ++++ b/drivers/net/ethernet/mscc/ocelot.c +@@ -583,18 +583,10 @@ int ocelot_port_add_txtstamp_skb(struct + + if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP && + ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) { +- struct ocelot_skb *oskb = +- kzalloc(sizeof(struct ocelot_skb), GFP_ATOMIC); +- +- if (unlikely(!oskb)) +- return -ENOMEM; +- + shinfo->tx_flags |= SKBTX_IN_PROGRESS; +- +- oskb->skb = skb; +- oskb->id = ocelot_port->ts_id % 4; +- +- list_add_tail(&oskb->head, &ocelot_port->skbs); ++ /* Store timestamp ID in cb[0] of sk_buff */ ++ skb->cb[0] = ocelot_port->ts_id % 4; ++ skb_queue_tail(&ocelot_port->tx_skbs, skb); + return 0; + } + return -ENODATA; +@@ -704,12 +696,11 @@ void ocelot_get_txtstamp(struct ocelot * + int budget = OCELOT_PTP_QUEUE_SZ; + + while (budget--) { ++ struct sk_buff *skb, *skb_tmp, *skb_match = NULL; + struct skb_shared_hwtstamps shhwtstamps; +- struct list_head *pos, *tmp; +- struct sk_buff *skb = NULL; +- struct ocelot_skb *entry; + struct ocelot_port *port; + struct timespec64 ts; ++ unsigned long flags; + u32 val, id, txport; + + val = ocelot_read(ocelot, SYS_PTP_STATUS); +@@ -727,22 +718,22 @@ void ocelot_get_txtstamp(struct ocelot * + /* Retrieve its associated skb */ + port = ocelot->ports[txport]; + +- list_for_each_safe(pos, tmp, &port->skbs) { +- entry = list_entry(pos, struct ocelot_skb, head); +- if (entry->id != id) +- continue; ++ spin_lock_irqsave(&port->tx_skbs.lock, flags); + +- skb = entry->skb; +- +- list_del(pos); +- kfree(entry); ++ skb_queue_walk_safe(&port->tx_skbs, skb, skb_tmp) { ++ if (skb->cb[0] != id) ++ continue; ++ __skb_unlink(skb, &port->tx_skbs); ++ skb_match = skb; + break; + } + ++ spin_unlock_irqrestore(&port->tx_skbs.lock, flags); ++ + /* Next ts */ + ocelot_write(ocelot, SYS_PTP_NXT_PTP_NXT, SYS_PTP_NXT); + +- if (unlikely(!skb)) ++ if (unlikely(!skb_match)) + continue; + + /* Get the h/w timestamp */ +@@ -751,9 +742,9 @@ void ocelot_get_txtstamp(struct ocelot * + /* Set the timestamp into the skb */ + memset(&shhwtstamps, 0, sizeof(shhwtstamps)); + shhwtstamps.hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec); +- skb_tstamp_tx(skb, &shhwtstamps); ++ skb_tstamp_tx(skb_match, &shhwtstamps); + +- dev_kfree_skb_any(skb); ++ dev_kfree_skb_any(skb_match); + } + } + EXPORT_SYMBOL(ocelot_get_txtstamp); +@@ -2210,7 +2201,7 @@ void ocelot_init_port(struct ocelot *oce + { + struct ocelot_port *ocelot_port = ocelot->ports[port]; + +- INIT_LIST_HEAD(&ocelot_port->skbs); ++ skb_queue_head_init(&ocelot_port->tx_skbs); + + /* Basic L2 initialization */ + +@@ -2495,9 +2486,7 @@ EXPORT_SYMBOL(ocelot_init); + + void ocelot_deinit(struct ocelot *ocelot) + { +- struct list_head *pos, *tmp; + struct ocelot_port *port; +- struct ocelot_skb *entry; + int i; + + cancel_delayed_work(&ocelot->stats_work); +@@ -2509,14 +2498,7 @@ void ocelot_deinit(struct ocelot *ocelot + + for (i = 0; i < ocelot->num_phys_ports; i++) { + port = ocelot->ports[i]; +- +- list_for_each_safe(pos, tmp, &port->skbs) { +- entry = list_entry(pos, struct ocelot_skb, head); +- +- list_del(pos); +- dev_kfree_skb_any(entry->skb); +- kfree(entry); +- } ++ skb_queue_purge(&port->tx_skbs); + } + } + EXPORT_SYMBOL(ocelot_deinit); +--- a/include/soc/mscc/ocelot.h ++++ b/include/soc/mscc/ocelot.h +@@ -406,13 +406,6 @@ struct ocelot_ops { + int (*reset)(struct ocelot *ocelot); + }; + +-struct ocelot_skb { +- struct list_head head; +- struct sk_buff *skb; +- u8 id; +-}; +- +- + struct ocelot_port { + struct ocelot *ocelot; + +@@ -425,7 +418,7 @@ struct ocelot_port { + u16 vid; + + u8 ptp_cmd; +- struct list_head skbs; ++ struct sk_buff_head tx_skbs; + u8 ts_id; + }; + |