All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next 00/12] Generic TX reallocation for DSA
@ 2020-10-30  1:48 Vladimir Oltean
  2020-10-30  1:48 ` [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure Vladimir Oltean
                   ` (11 more replies)
  0 siblings, 12 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:48 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach

Christian has reported buggy usage of skb_put() in tag_ksz.c, which is
only triggerable in real life using his not-yet-published patches for
IEEE 1588 timestamping on Micrel KSZ switches.

The concrete problem there is that the driver can end up calling
skb_put() and exceed the end of the skb data area, because even though
it had reallocated the frame once before, it hadn't reallocated it large
enough. Christian explained it in more detail here:

https://lore.kernel.org/netdev/20201014161719.30289-1-ceggers@arri.de/
https://lore.kernel.org/netdev/20201016200226.23994-1-ceggers@arri.de/

But actually there's a bigger problem, which is that some taggers which
get more rarely tested tend to do some shenanigans which are uncaught
for the longest time, and in the meanwhile, their code gets copy-pasted
into other taggers, creating a mess. For example, the tail tagging
driver for Marvell 88E6060 currently reallocates _every_single_frame_ on
TX. Is that an obvious indication that nobody is using it? Sure. Is it a
good model to follow when developing a new tail tagging driver? No.

DSA has all the information it needs in order to simplify the job of a
tagger on TX. It knows whether it's a normal or a tail tagger, and what
is the protocol overhead it incurs. So this series performs the
reallocation centrally.

Changes in v2:
- Dropped the tx_realloc counters for now, since the patch was pretty
  controversial and I lack the time at the moment to introduce new UAPI
  for that.
- Do padding for tail taggers irrespective of whether they need to
  reallocate the skb or not.

Christian Eggers (2):
  net: dsa: tag_ksz: don't allocate additional memory for
    padding/tagging
  net: dsa: trailer: don't allocate additional memory for
    padding/tagging

Vladimir Oltean (10):
  net: dsa: implement a central TX reallocation procedure
  net: dsa: tag_qca: let DSA core deal with TX reallocation
  net: dsa: tag_ocelot: let DSA core deal with TX reallocation
  net: dsa: tag_mtk: let DSA core deal with TX reallocation
  net: dsa: tag_lan9303: let DSA core deal with TX reallocation
  net: dsa: tag_edsa: let DSA core deal with TX reallocation
  net: dsa: tag_brcm: let DSA core deal with TX reallocation
  net: dsa: tag_dsa: let DSA core deal with TX reallocation
  net: dsa: tag_gswip: let DSA core deal with TX reallocation
  net: dsa: tag_ar9331: let DSA core deal with TX reallocation

 net/dsa/slave.c       | 45 ++++++++++++++++++++++++++
 net/dsa/tag_ar9331.c  |  3 --
 net/dsa/tag_brcm.c    |  3 --
 net/dsa/tag_dsa.c     |  5 ---
 net/dsa/tag_edsa.c    |  4 ---
 net/dsa/tag_gswip.c   |  5 ---
 net/dsa/tag_ksz.c     | 73 ++++++-------------------------------------
 net/dsa/tag_lan9303.c |  9 ------
 net/dsa/tag_mtk.c     |  3 --
 net/dsa/tag_ocelot.c  |  7 -----
 net/dsa/tag_qca.c     |  3 --
 net/dsa/tag_trailer.c | 31 ++----------------
 12 files changed, 56 insertions(+), 135 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
@ 2020-10-30  1:48 ` Vladimir Oltean
  2020-10-30  6:41   ` Kurt Kanzenbach
  2020-11-01  1:00   ` Jakub Kicinski
  2020-10-30  1:49 ` [PATCH v2 net-next 02/12] net: dsa: tag_ksz: don't allocate additional memory for padding/tagging Vladimir Oltean
                   ` (10 subsequent siblings)
  11 siblings, 2 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:48 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach

At the moment, taggers are left with the task of ensuring that the skb
headers are writable (which they aren't, if the frames were cloned for
TX timestamping, for flooding by the bridge, etc), and that there is
enough space in the skb data area for the DSA tag to be pushed.

Moreover, the life of tail taggers is even harder, because they need to
ensure that short frames have enough padding, a problem that normal
taggers don't have.

The principle of the DSA framework is that everything except for the
most intimate hardware specifics (like in this case, the actual packing
of the DSA tag bits) should be done inside the core, to avoid having
code paths that are very rarely tested.

So provide a TX reallocation procedure that should cover the known needs
of DSA today.

Note that this patch also gives the network stack a good hint about the
headroom/tailroom it's going to need. Up till now it wasn't doing that.
So the reallocation procedure should really be there only for the
exceptional cases, and for cloned packets which need to be unshared.
The tx_reallocs counter should prove that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Christian Eggers <ceggers@arri.de> # For tail taggers only
---
Changes in v2:
- Dropped the tx_realloc counters for now, since the patch was pretty
  controversial and I lack the time at the moment to introduce new UAPI
  for that.
- Do padding for tail taggers irrespective of whether they need to
  reallocate the skb or not.

 net/dsa/slave.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 3bc5ca40c9fb..10be715cf462 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -548,6 +548,30 @@ netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev)
 }
 EXPORT_SYMBOL_GPL(dsa_enqueue_skb);
 
+static int dsa_realloc_skb(struct sk_buff *skb, struct net_device *dev)
+{
+	int needed_headroom = dev->needed_headroom;
+	int needed_tailroom = dev->needed_tailroom;
+
+	/* For tail taggers, we need to pad short frames ourselves, to ensure
+	 * that the tail tag does not fail at its role of being at the end of
+	 * the packet, once the master interface pads the frame. Account for
+	 * that pad length here, and pad later.
+	 */
+	if (unlikely(needed_tailroom && skb->len < ETH_ZLEN))
+		needed_tailroom += ETH_ZLEN - skb->len;
+	/* skb_headroom() returns unsigned int... */
+	needed_headroom = max_t(int, needed_headroom - skb_headroom(skb), 0);
+	needed_tailroom = max_t(int, needed_tailroom - skb_tailroom(skb), 0);
+
+	if (likely(!needed_headroom && !needed_tailroom && !skb_cloned(skb)))
+		/* No reallocation needed, yay! */
+		return 0;
+
+	return pskb_expand_head(skb, needed_headroom, needed_tailroom,
+				GFP_ATOMIC);
+}
+
 static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct dsa_slave_priv *p = netdev_priv(dev);
@@ -567,6 +591,17 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
 	 */
 	dsa_skb_tx_timestamp(p, skb);
 
+	if (dsa_realloc_skb(skb, dev)) {
+		kfree_skb(skb);
+		return NETDEV_TX_OK;
+	}
+
+	/* needed_tailroom should still be 'warm' in the cache line from
+	 * dsa_realloc_skb(), which has also ensured that padding is safe.
+	 */
+	if (dev->needed_tailroom)
+		eth_skb_pad(skb);
+
 	/* Transmit function may have to reallocate the original SKB,
 	 * in which case it must have freed it. Only free it here on error.
 	 */
@@ -1791,6 +1826,16 @@ int dsa_slave_create(struct dsa_port *port)
 	slave_dev->netdev_ops = &dsa_slave_netdev_ops;
 	if (ds->ops->port_max_mtu)
 		slave_dev->max_mtu = ds->ops->port_max_mtu(ds, port->index);
+	if (cpu_dp->tag_ops->tail_tag)
+		slave_dev->needed_tailroom = cpu_dp->tag_ops->overhead;
+	else
+		slave_dev->needed_headroom = cpu_dp->tag_ops->overhead;
+	/* Try to save one extra realloc later in the TX path (in the master)
+	 * by also inheriting the master's needed headroom and tailroom.
+	 * The 8021q driver also does this.
+	 */
+	slave_dev->needed_headroom += master->needed_headroom;
+	slave_dev->needed_tailroom += master->needed_tailroom;
 	SET_NETDEV_DEVTYPE(slave_dev, &dsa_type);
 
 	netdev_for_each_tx_queue(slave_dev, dsa_slave_set_lockdep_class_one,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 02/12] net: dsa: tag_ksz: don't allocate additional memory for padding/tagging
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
  2020-10-30  1:48 ` [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 03/12] net: dsa: trailer: " Vladimir Oltean
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach

From: Christian Eggers <ceggers@arri.de>

The caller (dsa_slave_xmit) guarantees that the frame length is at least
ETH_ZLEN and that enough memory for tail tagging is available.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_ksz.c | 73 ++++++-----------------------------------------
 1 file changed, 9 insertions(+), 64 deletions(-)

diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
index 0a5aa982c60d..4820dbcedfa2 100644
--- a/net/dsa/tag_ksz.c
+++ b/net/dsa/tag_ksz.c
@@ -14,46 +14,6 @@
 #define KSZ_EGRESS_TAG_LEN		1
 #define KSZ_INGRESS_TAG_LEN		1
 
-static struct sk_buff *ksz_common_xmit(struct sk_buff *skb,
-				       struct net_device *dev, int len)
-{
-	struct sk_buff *nskb;
-	int padlen;
-
-	padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len;
-
-	if (skb_tailroom(skb) >= padlen + len) {
-		/* Let dsa_slave_xmit() free skb */
-		if (__skb_put_padto(skb, skb->len + padlen, false))
-			return NULL;
-
-		nskb = skb;
-	} else {
-		nskb = alloc_skb(NET_IP_ALIGN + skb->len +
-				 padlen + len, GFP_ATOMIC);
-		if (!nskb)
-			return NULL;
-		skb_reserve(nskb, NET_IP_ALIGN);
-
-		skb_reset_mac_header(nskb);
-		skb_set_network_header(nskb,
-				       skb_network_header(skb) - skb->head);
-		skb_set_transport_header(nskb,
-					 skb_transport_header(skb) - skb->head);
-		skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
-
-		/* Let skb_put_padto() free nskb, and let dsa_slave_xmit() free
-		 * skb
-		 */
-		if (skb_put_padto(nskb, nskb->len + padlen))
-			return NULL;
-
-		consume_skb(skb);
-	}
-
-	return nskb;
-}
-
 static struct sk_buff *ksz_common_rcv(struct sk_buff *skb,
 				      struct net_device *dev,
 				      unsigned int port, unsigned int len)
@@ -90,23 +50,18 @@ static struct sk_buff *ksz_common_rcv(struct sk_buff *skb,
 static struct sk_buff *ksz8795_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct dsa_port *dp = dsa_slave_to_port(dev);
-	struct sk_buff *nskb;
 	u8 *tag;
 	u8 *addr;
 
-	nskb = ksz_common_xmit(skb, dev, KSZ_INGRESS_TAG_LEN);
-	if (!nskb)
-		return NULL;
-
 	/* Tag encoding */
-	tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN);
-	addr = skb_mac_header(nskb);
+	tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
+	addr = skb_mac_header(skb);
 
 	*tag = 1 << dp->index;
 	if (is_link_local_ether_addr(addr))
 		*tag |= KSZ8795_TAIL_TAG_OVERRIDE;
 
-	return nskb;
+	return skb;
 }
 
 static struct sk_buff *ksz8795_rcv(struct sk_buff *skb, struct net_device *dev,
@@ -156,18 +111,13 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
 				    struct net_device *dev)
 {
 	struct dsa_port *dp = dsa_slave_to_port(dev);
-	struct sk_buff *nskb;
 	__be16 *tag;
 	u8 *addr;
 	u16 val;
 
-	nskb = ksz_common_xmit(skb, dev, KSZ9477_INGRESS_TAG_LEN);
-	if (!nskb)
-		return NULL;
-
 	/* Tag encoding */
-	tag = skb_put(nskb, KSZ9477_INGRESS_TAG_LEN);
-	addr = skb_mac_header(nskb);
+	tag = skb_put(skb, KSZ9477_INGRESS_TAG_LEN);
+	addr = skb_mac_header(skb);
 
 	val = BIT(dp->index);
 
@@ -176,7 +126,7 @@ static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
 
 	*tag = cpu_to_be16(val);
 
-	return nskb;
+	return skb;
 }
 
 static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev,
@@ -213,24 +163,19 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb,
 				    struct net_device *dev)
 {
 	struct dsa_port *dp = dsa_slave_to_port(dev);
-	struct sk_buff *nskb;
 	u8 *addr;
 	u8 *tag;
 
-	nskb = ksz_common_xmit(skb, dev, KSZ_INGRESS_TAG_LEN);
-	if (!nskb)
-		return NULL;
-
 	/* Tag encoding */
-	tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN);
-	addr = skb_mac_header(nskb);
+	tag = skb_put(skb, KSZ_INGRESS_TAG_LEN);
+	addr = skb_mac_header(skb);
 
 	*tag = BIT(dp->index);
 
 	if (is_link_local_ether_addr(addr))
 		*tag |= KSZ9893_TAIL_TAG_OVERRIDE;
 
-	return nskb;
+	return skb;
 }
 
 static const struct dsa_device_ops ksz9893_netdev_ops = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 03/12] net: dsa: trailer: don't allocate additional memory for padding/tagging
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
  2020-10-30  1:48 ` [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 02/12] net: dsa: tag_ksz: don't allocate additional memory for padding/tagging Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 04/12] net: dsa: tag_qca: let DSA core deal with TX reallocation Vladimir Oltean
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach

From: Christian Eggers <ceggers@arri.de>

The caller (dsa_slave_xmit) guarantees that the frame length is at least
ETH_ZLEN and that enough memory for tail tagging is available.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_trailer.c | 31 ++-----------------------------
 1 file changed, 2 insertions(+), 29 deletions(-)

diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c
index 3a1cc24a4f0a..5b97ede56a0f 100644
--- a/net/dsa/tag_trailer.c
+++ b/net/dsa/tag_trailer.c
@@ -13,42 +13,15 @@
 static struct sk_buff *trailer_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct dsa_port *dp = dsa_slave_to_port(dev);
-	struct sk_buff *nskb;
-	int padlen;
 	u8 *trailer;
 
-	/*
-	 * We have to make sure that the trailer ends up as the very
-	 * last 4 bytes of the packet.  This means that we have to pad
-	 * the packet to the minimum ethernet frame size, if necessary,
-	 * before adding the trailer.
-	 */
-	padlen = 0;
-	if (skb->len < 60)
-		padlen = 60 - skb->len;
-
-	nskb = alloc_skb(NET_IP_ALIGN + skb->len + padlen + 4, GFP_ATOMIC);
-	if (!nskb)
-		return NULL;
-	skb_reserve(nskb, NET_IP_ALIGN);
-
-	skb_reset_mac_header(nskb);
-	skb_set_network_header(nskb, skb_network_header(skb) - skb->head);
-	skb_set_transport_header(nskb, skb_transport_header(skb) - skb->head);
-	skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
-	consume_skb(skb);
-
-	if (padlen) {
-		skb_put_zero(nskb, padlen);
-	}
-
-	trailer = skb_put(nskb, 4);
+	trailer = skb_put(skb, 4);
 	trailer[0] = 0x80;
 	trailer[1] = 1 << dp->index;
 	trailer[2] = 0x10;
 	trailer[3] = 0x00;
 
-	return nskb;
+	return skb;
 }
 
 static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 04/12] net: dsa: tag_qca: let DSA core deal with TX reallocation
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
                   ` (2 preceding siblings ...)
  2020-10-30  1:49 ` [PATCH v2 net-next 03/12] net: dsa: trailer: " Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 05/12] net: dsa: tag_ocelot: " Vladimir Oltean
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach, John Crispin, Alexander Lobakin

Now that we have a central TX reallocation procedure that accounts for
the tagger's needed headroom in a generic way, we can remove the
skb_cow_head call.

Cc: John Crispin <john@phrozen.org>
Cc: Alexander Lobakin <alobakin@pm.me>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_qca.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c
index 1b9e8507112b..88181b52f480 100644
--- a/net/dsa/tag_qca.c
+++ b/net/dsa/tag_qca.c
@@ -34,9 +34,6 @@ static struct sk_buff *qca_tag_xmit(struct sk_buff *skb, struct net_device *dev)
 	__be16 *phdr;
 	u16 hdr;
 
-	if (skb_cow_head(skb, QCA_HDR_LEN) < 0)
-		return NULL;
-
 	skb_push(skb, QCA_HDR_LEN);
 
 	memmove(skb->data, skb->data + QCA_HDR_LEN, 2 * ETH_ALEN);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 05/12] net: dsa: tag_ocelot: let DSA core deal with TX reallocation
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
                   ` (3 preceding siblings ...)
  2020-10-30  1:49 ` [PATCH v2 net-next 04/12] net: dsa: tag_qca: let DSA core deal with TX reallocation Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 06/12] net: dsa: tag_mtk: " Vladimir Oltean
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach

Now that we have a central TX reallocation procedure that accounts for
the tagger's needed headroom in a generic way, we can remove the
skb_cow_head call.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_ocelot.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/net/dsa/tag_ocelot.c b/net/dsa/tag_ocelot.c
index 3b468aca5c53..16a1afd5b8e1 100644
--- a/net/dsa/tag_ocelot.c
+++ b/net/dsa/tag_ocelot.c
@@ -143,13 +143,6 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb,
 	struct ocelot_port *ocelot_port;
 	u8 *prefix, *injection;
 	u64 qos_class, rew_op;
-	int err;
-
-	err = skb_cow_head(skb, OCELOT_TOTAL_TAG_LEN);
-	if (unlikely(err < 0)) {
-		netdev_err(netdev, "Cannot make room for tag.\n");
-		return NULL;
-	}
 
 	ocelot_port = ocelot->ports[dp->index];
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 06/12] net: dsa: tag_mtk: let DSA core deal with TX reallocation
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
                   ` (4 preceding siblings ...)
  2020-10-30  1:49 ` [PATCH v2 net-next 05/12] net: dsa: tag_ocelot: " Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 07/12] net: dsa: tag_lan9303: " Vladimir Oltean
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach, DENG Qingfang, Sean Wang, John Crispin

Now that we have a central TX reallocation procedure that accounts for
the tagger's needed headroom in a generic way, we can remove the
skb_cow_head call.

Cc: DENG Qingfang <dqfext@gmail.com>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: John Crispin <john@phrozen.org>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_mtk.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
index 4cdd9cf428fb..38dcdded74c0 100644
--- a/net/dsa/tag_mtk.c
+++ b/net/dsa/tag_mtk.c
@@ -34,9 +34,6 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
 	 * table with VID.
 	 */
 	if (!skb_vlan_tagged(skb)) {
-		if (skb_cow_head(skb, MTK_HDR_LEN) < 0)
-			return NULL;
-
 		skb_push(skb, MTK_HDR_LEN);
 		memmove(skb->data, skb->data + MTK_HDR_LEN, 2 * ETH_ALEN);
 		is_vlan_skb = false;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 07/12] net: dsa: tag_lan9303: let DSA core deal with TX reallocation
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
                   ` (5 preceding siblings ...)
  2020-10-30  1:49 ` [PATCH v2 net-next 06/12] net: dsa: tag_mtk: " Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 08/12] net: dsa: tag_edsa: " Vladimir Oltean
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach

Now that we have a central TX reallocation procedure that accounts for
the tagger's needed headroom in a generic way, we can remove the
skb_cow_head call.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_lan9303.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c
index ccfb6f641bbf..aa1318dccaf0 100644
--- a/net/dsa/tag_lan9303.c
+++ b/net/dsa/tag_lan9303.c
@@ -58,15 +58,6 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev)
 	__be16 *lan9303_tag;
 	u16 tag;
 
-	/* insert a special VLAN tag between the MAC addresses
-	 * and the current ethertype field.
-	 */
-	if (skb_cow_head(skb, LAN9303_TAG_LEN) < 0) {
-		dev_dbg(&dev->dev,
-			"Cannot make room for the special tag. Dropping packet\n");
-		return NULL;
-	}
-
 	/* provide 'LAN9303_TAG_LEN' bytes additional space */
 	skb_push(skb, LAN9303_TAG_LEN);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 08/12] net: dsa: tag_edsa: let DSA core deal with TX reallocation
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
                   ` (6 preceding siblings ...)
  2020-10-30  1:49 ` [PATCH v2 net-next 07/12] net: dsa: tag_lan9303: " Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 09/12] net: dsa: tag_brcm: " Vladimir Oltean
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach

Now that we have a central TX reallocation procedure that accounts for
the tagger's needed headroom in a generic way, we can remove the
skb_cow_head call.

Note that the VLAN code path needs a smaller extra headroom than the
regular EtherType DSA path. That isn't a problem, because this tagger
declares the larger tag length (8 bytes vs 4) as the protocol overhead,
so we are covered in both cases.

Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_edsa.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c
index 120614240319..abf70a29deb4 100644
--- a/net/dsa/tag_edsa.c
+++ b/net/dsa/tag_edsa.c
@@ -35,8 +35,6 @@ static struct sk_buff *edsa_xmit(struct sk_buff *skb, struct net_device *dev)
 	 * current ethertype field if the packet is untagged.
 	 */
 	if (skb->protocol == htons(ETH_P_8021Q)) {
-		if (skb_cow_head(skb, DSA_HLEN) < 0)
-			return NULL;
 		skb_push(skb, DSA_HLEN);
 
 		memmove(skb->data, skb->data + DSA_HLEN, 2 * ETH_ALEN);
@@ -60,8 +58,6 @@ static struct sk_buff *edsa_xmit(struct sk_buff *skb, struct net_device *dev)
 			edsa_header[6] &= ~0x10;
 		}
 	} else {
-		if (skb_cow_head(skb, EDSA_HLEN) < 0)
-			return NULL;
 		skb_push(skb, EDSA_HLEN);
 
 		memmove(skb->data, skb->data + EDSA_HLEN, 2 * ETH_ALEN);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 09/12] net: dsa: tag_brcm: let DSA core deal with TX reallocation
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
                   ` (7 preceding siblings ...)
  2020-10-30  1:49 ` [PATCH v2 net-next 08/12] net: dsa: tag_edsa: " Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 10/12] net: dsa: tag_dsa: " Vladimir Oltean
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach

Now that we have a central TX reallocation procedure that accounts for
the tagger's needed headroom in a generic way, we can remove the
skb_cow_head call.

Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_brcm.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index ad72dff8d524..e934dace3922 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -66,9 +66,6 @@ static struct sk_buff *brcm_tag_xmit_ll(struct sk_buff *skb,
 	u16 queue = skb_get_queue_mapping(skb);
 	u8 *brcm_tag;
 
-	if (skb_cow_head(skb, BRCM_TAG_LEN) < 0)
-		return NULL;
-
 	/* The Ethernet switch we are interfaced with needs packets to be at
 	 * least 64 bytes (including FCS) otherwise they will be discarded when
 	 * they enter the switch port logic. When Broadcom tags are enabled, we
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 10/12] net: dsa: tag_dsa: let DSA core deal with TX reallocation
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
                   ` (8 preceding siblings ...)
  2020-10-30  1:49 ` [PATCH v2 net-next 09/12] net: dsa: tag_brcm: " Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 11/12] net: dsa: tag_gswip: " Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 12/12] net: dsa: tag_ar9331: " Vladimir Oltean
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach

Now that we have a central TX reallocation procedure that accounts for
the tagger's needed headroom in a generic way, we can remove the
skb_cow_head call.

Similar to the EtherType DSA tagger, the old Marvell tagger can
transform an 802.1Q header if present into a DSA tag, so there is no
headroom required in that case. But we are ensuring that it exists,
regardless (practically speaking, the headroom must be 4 bytes larger
than it needs to be).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_dsa.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
index 0b756fae68a5..63d690a0fca6 100644
--- a/net/dsa/tag_dsa.c
+++ b/net/dsa/tag_dsa.c
@@ -23,9 +23,6 @@ static struct sk_buff *dsa_xmit(struct sk_buff *skb, struct net_device *dev)
 	 * the ethertype field for untagged packets.
 	 */
 	if (skb->protocol == htons(ETH_P_8021Q)) {
-		if (skb_cow_head(skb, 0) < 0)
-			return NULL;
-
 		/*
 		 * Construct tagged FROM_CPU DSA tag from 802.1q tag.
 		 */
@@ -41,8 +38,6 @@ static struct sk_buff *dsa_xmit(struct sk_buff *skb, struct net_device *dev)
 			dsa_header[2] &= ~0x10;
 		}
 	} else {
-		if (skb_cow_head(skb, DSA_HLEN) < 0)
-			return NULL;
 		skb_push(skb, DSA_HLEN);
 
 		memmove(skb->data, skb->data + DSA_HLEN, 2 * ETH_ALEN);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 11/12] net: dsa: tag_gswip: let DSA core deal with TX reallocation
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
                   ` (9 preceding siblings ...)
  2020-10-30  1:49 ` [PATCH v2 net-next 10/12] net: dsa: tag_dsa: " Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  1:49 ` [PATCH v2 net-next 12/12] net: dsa: tag_ar9331: " Vladimir Oltean
  11 siblings, 0 replies; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach, Hauke Mehrtens

Now that we have a central TX reallocation procedure that accounts for
the tagger's needed headroom in a generic way, we can remove the
skb_cow_head call.

This one is interesting, the DSA tag is 8 bytes on RX and 4 bytes on TX.
Because DSA is unaware of asymmetrical tag lengths, the overhead/needed
headroom is declared as 8 bytes and therefore 4 bytes larger than it
needs to be. If this becomes a problem, and the GSWIP driver can't be
converted to a uniform header length, we might need to make DSA aware of
separate RX/TX overhead values.

Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_gswip.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/net/dsa/tag_gswip.c b/net/dsa/tag_gswip.c
index 408d4af390a0..2f5bd5e338ab 100644
--- a/net/dsa/tag_gswip.c
+++ b/net/dsa/tag_gswip.c
@@ -60,13 +60,8 @@ static struct sk_buff *gswip_tag_xmit(struct sk_buff *skb,
 				      struct net_device *dev)
 {
 	struct dsa_port *dp = dsa_slave_to_port(dev);
-	int err;
 	u8 *gswip_tag;
 
-	err = skb_cow_head(skb, GSWIP_TX_HEADER_LEN);
-	if (err)
-		return NULL;
-
 	skb_push(skb, GSWIP_TX_HEADER_LEN);
 
 	gswip_tag = skb->data;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 net-next 12/12] net: dsa: tag_ar9331: let DSA core deal with TX reallocation
  2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
                   ` (10 preceding siblings ...)
  2020-10-30  1:49 ` [PATCH v2 net-next 11/12] net: dsa: tag_gswip: " Vladimir Oltean
@ 2020-10-30  1:49 ` Vladimir Oltean
  2020-10-30  9:21   ` Oleksij Rempel
  11 siblings, 1 reply; 19+ messages in thread
From: Vladimir Oltean @ 2020-10-30  1:49 UTC (permalink / raw)
  To: netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers,
	Kurt Kanzenbach, Per Forlin, Oleksij Rempel

Now that we have a central TX reallocation procedure that accounts for
the tagger's needed headroom in a generic way, we can remove the
skb_cow_head call.

Cc: Per Forlin <per.forlin@axis.com>
Cc: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Changes in v2:
None.

 net/dsa/tag_ar9331.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/dsa/tag_ar9331.c b/net/dsa/tag_ar9331.c
index 55b00694cdba..002cf7f952e2 100644
--- a/net/dsa/tag_ar9331.c
+++ b/net/dsa/tag_ar9331.c
@@ -31,9 +31,6 @@ static struct sk_buff *ar9331_tag_xmit(struct sk_buff *skb,
 	__le16 *phdr;
 	u16 hdr;
 
-	if (skb_cow_head(skb, AR9331_HDR_LEN) < 0)
-		return NULL;
-
 	phdr = skb_push(skb, AR9331_HDR_LEN);
 
 	hdr = FIELD_PREP(AR9331_HDR_VERSION_MASK, AR9331_HDR_VERSION);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure
  2020-10-30  1:48 ` [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure Vladimir Oltean
@ 2020-10-30  6:41   ` Kurt Kanzenbach
  2020-11-01  1:00   ` Jakub Kicinski
  1 sibling, 0 replies; 19+ messages in thread
From: Kurt Kanzenbach @ 2020-10-30  6:41 UTC (permalink / raw)
  To: Vladimir Oltean, netdev
  Cc: andrew, f.fainelli, vivien.didelot, kuba, Christian Eggers

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]

On Fri Oct 30 2020, Vladimir Oltean wrote:
> At the moment, taggers are left with the task of ensuring that the skb
> headers are writable (which they aren't, if the frames were cloned for
> TX timestamping, for flooding by the bridge, etc), and that there is
> enough space in the skb data area for the DSA tag to be pushed.
>
> Moreover, the life of tail taggers is even harder, because they need to
> ensure that short frames have enough padding, a problem that normal
> taggers don't have.
>
> The principle of the DSA framework is that everything except for the
> most intimate hardware specifics (like in this case, the actual packing
> of the DSA tag bits) should be done inside the core, to avoid having
> code paths that are very rarely tested.
>
> So provide a TX reallocation procedure that should cover the known needs
> of DSA today.
>
> Note that this patch also gives the network stack a good hint about the
> headroom/tailroom it's going to need. Up till now it wasn't doing that.
> So the reallocation procedure should really be there only for the
> exceptional cases, and for cloned packets which need to be unshared.
> The tx_reallocs counter should prove that.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Tested-by: Christian Eggers <ceggers@arri.de> # For tail taggers only

Tested-by: Kurt Kanzenbach <kurt@linutronix.de>

I'll wait with the hellcreek series until this is merged.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 net-next 12/12] net: dsa: tag_ar9331: let DSA core deal with TX reallocation
  2020-10-30  1:49 ` [PATCH v2 net-next 12/12] net: dsa: tag_ar9331: " Vladimir Oltean
@ 2020-10-30  9:21   ` Oleksij Rempel
  0 siblings, 0 replies; 19+ messages in thread
From: Oleksij Rempel @ 2020-10-30  9:21 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, andrew, f.fainelli, vivien.didelot, kuba,
	Christian Eggers, Kurt Kanzenbach, Per Forlin, Oleksij Rempel

On Fri, Oct 30, 2020 at 03:49:10AM +0200, Vladimir Oltean wrote:
> Now that we have a central TX reallocation procedure that accounts for
> the tagger's needed headroom in a generic way, we can remove the
> skb_cow_head call.
> 
> Cc: Per Forlin <per.forlin@axis.com>
> Cc: Oleksij Rempel <linux@rempel-privat.de>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Tested-by: Oleksij Rempel <linux@rempel-privat.de>

> ---
> Changes in v2:
> None.
> 
>  net/dsa/tag_ar9331.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/net/dsa/tag_ar9331.c b/net/dsa/tag_ar9331.c
> index 55b00694cdba..002cf7f952e2 100644
> --- a/net/dsa/tag_ar9331.c
> +++ b/net/dsa/tag_ar9331.c
> @@ -31,9 +31,6 @@ static struct sk_buff *ar9331_tag_xmit(struct sk_buff *skb,
>  	__le16 *phdr;
>  	u16 hdr;
>  
> -	if (skb_cow_head(skb, AR9331_HDR_LEN) < 0)
> -		return NULL;
> -
>  	phdr = skb_push(skb, AR9331_HDR_LEN);
>  
>  	hdr = FIELD_PREP(AR9331_HDR_VERSION_MASK, AR9331_HDR_VERSION);
> -- 
> 2.25.1
> 

Regards,
Oleksij

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure
  2020-10-30  1:48 ` [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure Vladimir Oltean
  2020-10-30  6:41   ` Kurt Kanzenbach
@ 2020-11-01  1:00   ` Jakub Kicinski
  2020-11-01  1:14     ` Vladimir Oltean
  1 sibling, 1 reply; 19+ messages in thread
From: Jakub Kicinski @ 2020-11-01  1:00 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, andrew, f.fainelli, vivien.didelot, Christian Eggers,
	Kurt Kanzenbach

On Fri, 30 Oct 2020 03:48:59 +0200 Vladimir Oltean wrote:
> @@ -567,6 +591,17 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
>  	 */
>  	dsa_skb_tx_timestamp(p, skb);
>  
> +	if (dsa_realloc_skb(skb, dev)) {
> +		kfree_skb(skb);

dev_kfree_skb_any()?

> +		return NETDEV_TX_OK;
> +	}

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure
  2020-11-01  1:00   ` Jakub Kicinski
@ 2020-11-01  1:14     ` Vladimir Oltean
  2020-11-01  1:37       ` Vladimir Oltean
  0 siblings, 1 reply; 19+ messages in thread
From: Vladimir Oltean @ 2020-11-01  1:14 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Vladimir Oltean, netdev, andrew, f.fainelli, vivien.didelot,
	Christian Eggers, Kurt Kanzenbach

On Sat, Oct 31, 2020 at 06:00:43PM -0700, Jakub Kicinski wrote:
> On Fri, 30 Oct 2020 03:48:59 +0200 Vladimir Oltean wrote:
> > @@ -567,6 +591,17 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
> >  	 */
> >  	dsa_skb_tx_timestamp(p, skb);
> >  
> > +	if (dsa_realloc_skb(skb, dev)) {
> > +		kfree_skb(skb);
> 
> dev_kfree_skb_any()?

Just showing my ignorance, but where does the hardirq context come from?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure
  2020-11-01  1:14     ` Vladimir Oltean
@ 2020-11-01  1:37       ` Vladimir Oltean
  2020-11-02 19:57         ` Jakub Kicinski
  0 siblings, 1 reply; 19+ messages in thread
From: Vladimir Oltean @ 2020-11-01  1:37 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Vladimir Oltean, netdev, andrew, f.fainelli, vivien.didelot,
	Christian Eggers, Kurt Kanzenbach

On Sun, Nov 01, 2020 at 03:14:34AM +0200, Vladimir Oltean wrote:
> On Sat, Oct 31, 2020 at 06:00:43PM -0700, Jakub Kicinski wrote:
> > On Fri, 30 Oct 2020 03:48:59 +0200 Vladimir Oltean wrote:
> > > @@ -567,6 +591,17 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
> > >  	 */
> > >  	dsa_skb_tx_timestamp(p, skb);
> > >  
> > > +	if (dsa_realloc_skb(skb, dev)) {
> > > +		kfree_skb(skb);
> > 
> > dev_kfree_skb_any()?
> 
> Just showing my ignorance, but where does the hardirq context come from?

I mean I do see that netpoll_send_udp requires IRQs disabled, but is
that the only reason why all drivers need to assume hardirq context in
.xmit, or are there more?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure
  2020-11-01  1:37       ` Vladimir Oltean
@ 2020-11-02 19:57         ` Jakub Kicinski
  0 siblings, 0 replies; 19+ messages in thread
From: Jakub Kicinski @ 2020-11-02 19:57 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: Vladimir Oltean, netdev, andrew, f.fainelli, vivien.didelot,
	Christian Eggers, Kurt Kanzenbach

On Sun, 1 Nov 2020 03:37:28 +0200 Vladimir Oltean wrote:
> On Sun, Nov 01, 2020 at 03:14:34AM +0200, Vladimir Oltean wrote:
> > On Sat, Oct 31, 2020 at 06:00:43PM -0700, Jakub Kicinski wrote:  
> > > On Fri, 30 Oct 2020 03:48:59 +0200 Vladimir Oltean wrote:  
> > > > @@ -567,6 +591,17 @@ static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
> > > >  	 */
> > > >  	dsa_skb_tx_timestamp(p, skb);
> > > >  
> > > > +	if (dsa_realloc_skb(skb, dev)) {
> > > > +		kfree_skb(skb);  
> > > 
> > > dev_kfree_skb_any()?  
> > 
> > Just showing my ignorance, but where does the hardirq context come from?  
> 
> I mean I do see that netpoll_send_udp requires IRQs disabled, but is
> that the only reason why all drivers need to assume hardirq context in
> .xmit, or are there more?

netpoll is the only one that comes to my mind, maybe others know more..

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-11-02 19:58 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30  1:48 [PATCH v2 net-next 00/12] Generic TX reallocation for DSA Vladimir Oltean
2020-10-30  1:48 ` [PATCH v2 net-next 01/12] net: dsa: implement a central TX reallocation procedure Vladimir Oltean
2020-10-30  6:41   ` Kurt Kanzenbach
2020-11-01  1:00   ` Jakub Kicinski
2020-11-01  1:14     ` Vladimir Oltean
2020-11-01  1:37       ` Vladimir Oltean
2020-11-02 19:57         ` Jakub Kicinski
2020-10-30  1:49 ` [PATCH v2 net-next 02/12] net: dsa: tag_ksz: don't allocate additional memory for padding/tagging Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 03/12] net: dsa: trailer: " Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 04/12] net: dsa: tag_qca: let DSA core deal with TX reallocation Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 05/12] net: dsa: tag_ocelot: " Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 06/12] net: dsa: tag_mtk: " Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 07/12] net: dsa: tag_lan9303: " Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 08/12] net: dsa: tag_edsa: " Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 09/12] net: dsa: tag_brcm: " Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 10/12] net: dsa: tag_dsa: " Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 11/12] net: dsa: tag_gswip: " Vladimir Oltean
2020-10-30  1:49 ` [PATCH v2 net-next 12/12] net: dsa: tag_ar9331: " Vladimir Oltean
2020-10-30  9:21   ` Oleksij Rempel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.