* Re: linux-next: Tree for May 16 (net/core)
From: Randy Dunlap @ 2017-05-16 16:28 UTC (permalink / raw)
To: Stephen Rothwell, Linux-Next Mailing List
Cc: Linux Kernel Mailing List, netdev@vger.kernel.org
In-Reply-To: <20170516112125.517607f8@canb.auug.org.au>
On 05/15/17 18:21, Stephen Rothwell wrote:
> Hi all,
>
> Changes since 20170515:
>
on i386 or x86_64:
when CONFIG_INET is not enabled:
../net/core/sock.c: In function 'skb_orphan_partial':
../net/core/sock.c:1810:2: error: implicit declaration of function 'skb_is_tcp_pure_ack' [-Werror=implicit-function-declaration]
if (skb_is_tcp_pure_ack(skb))
^
--
~Randy
^ permalink raw reply
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: David Miller @ 2017-05-16 16:29 UTC (permalink / raw)
To: dledford
Cc: Bart.VanAssche, torvalds, hch, netdev, linux-rdma, stable, ubraun
In-Reply-To: <1494950224.3259.98.camel@redhat.com>
From: Doug Ledford <dledford@redhat.com>
Date: Tue, 16 May 2017 11:57:04 -0400
> Regardless though, I'm rather purturbed about this entire thing. If
> you are right that because this got into 4.11, it's now a done deal,
> then the fact that this went through 4 review cycles on netdev@ that,
> as I understand it, spanned roughly one years time, and not one single
> person bothered to note that this was as much an RDMA driver as
> anything else, and not one person bothered to note that linux-rdma@ was
> not on the Cc: list, and not one person told the submitters that they
> needed to include linux-rdma@ on the Cc: list of these submissions, and
> you took it without any review comments from any RDMA people in the
> course of a year, or an ack from me to show that the RDMA portion of
> this had at least been given some sort of review, was a collosal fuckup
> of cross tree maintainer cooperation.
We rely on people from various areas of expertiece to contribute to
patch review on netdev and give appropriate feedback.
If you actually look through the history, I made many semantic reviews
of the SMC changes, and kept pushing back.
And in fact I did this several times, making them go through several
revisions, in the hopes that someone would review more of the meat and
substance of the patch set.
Nobody do this for over a year.
I can't push back on people with silly coding style and small semantic
issues forever. And I think I made a serious effort to keep the
patches getting posted over and over again to make sure they got more
exposure.
I think it's unsettling that there are no RDMA experts, or at least
people remotely knowledgable about this "networking" technology,
subscribed to netdev and taking a cursory look at pactches that might
be relevant and effect that technology either directly or indirectly.
So there is a lot of blame to go around.
^ permalink raw reply
* [PATCH net-next v2 0/7] fix CRC32c in the forwarding path
From: Davide Caratti @ 2017-05-16 16:27 UTC (permalink / raw)
To: linux-sctp, netdev
Cc: Alexander Duyck, Tom Herbert, David Laight, David S. Miller,
Marcelo Ricardo Leitner
Current kernel allows offloading CRC32c computation when SCTP packets
are generated, setting skb->ip_summed to CHECKSUM_PARTIAL, if the
underlying device features have NETIF_F_SCTP_CRC set. However, after these
packets are forwarded, they may land on a device where CRC32c offloading is
not available: as a consequence, transmission is done with wrong CRC32c.
It's not possible to use sctp_compte_cksum() in the forwarding path
and in most drivers, because it needs symbols exported by libcrc32c module.
Patch 1 and 2 of this series try to solve this problem, introducing a new
helper function, namely skb_crc32c_csum_help(), that can be used to resolve
CHECKSUM_PARTIAL when crc32c is needed instead of Internet Checksum.
Currently, we need to parse the packet headers to understand what algorithm
is needed to resolve CHECKSUM_PARTIAL. We can speedup things by storing
this information in the skb metadata, and use it to call an appropriate
helper (skb_checksum_help or skb_crc32c_csum_help), or leave the packet
unmodified when the NIC is able to offload the checksum computation.
Patch 3 deprecates skb->csum_bad to free one bit in skb metadata; patch 4
introduces skb->csum_not_inet, providing skb with an indication on the
algorithm needed to resolve CHECKSUM_PARTIAL.
Patch 5 and 6 fix the kernel forwarding path and openvswitch datapath,
where skb_checksum_help was unconditionally called to resolve CHECKSUM_PARTIAL,
thus generating wrong CRC32c in forwarded SCTP packets.
Finally, patch 7 updates documentation to provide a better description of
possible values of skb->ip_summed.
Some further work is still possible:
* drivers that parse the packet header to correctly resolve CHECKSUM_PARTIAL
(e.g. ixgbe_tx_csum()) can benefit from testing skb->csum_not_inet to avoid
calling ip_hdr(skb)->protocol or ixgbe_ipv6_csum_is_sctp(skb).
* drivers that call skb_checksum_help() to resolve CHECKSUM_PARTIAL can
call skb_csum_hwoffload_help to avoid corrupting SCTP packets.
changes since RFCv4:
- patch 2/7: use WARN_ON_ONCE() instead of BUG_ON(), and avoid computing
CRC32c on the error path.
- patch 3/7: don't invert tests on the values of same_flow and
NAPI_GRO_CB(skb)->flush in dev_gro_receive(), it's useless and it breaks
GRO functionality as reported by kernel test robot.
Davide Caratti (7):
skbuff: add stub to help computing crc32c on SCTP packets
net: introduce skb_crc32c_csum_help
sk_buff: remove support for csum_bad in sk_buff
net: use skb->csum_not_inet to identify packets needing crc32c
net: more accurate checksumming in validate_xmit_skb()
openvswitch: more accurate checksumming in queue_userspace_packet()
sk_buff.h: improve description of CHECKSUM_{COMPLETE,UNNECESSARY}
Documentation/networking/checksum-offloads.txt | 11 +++--
drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 2 +-
include/linux/netdevice.h | 8 ++--
include/linux/skbuff.h | 58 +++++++++--------------
net/bridge/netfilter/nft_reject_bridge.c | 5 +-
net/core/dev.c | 59 ++++++++++++++++++++++--
net/core/skbuff.c | 24 ++++++++++
net/ipv4/netfilter/nf_reject_ipv4.c | 2 +-
net/ipv6/netfilter/nf_reject_ipv6.c | 3 --
net/openvswitch/datapath.c | 2 +-
net/sched/act_csum.c | 1 +
net/sctp/offload.c | 8 ++++
net/sctp/output.c | 1 +
13 files changed, 126 insertions(+), 58 deletions(-)
--
2.7.4
^ permalink raw reply
* [PATCH net-next v2 1/7] skbuff: add stub to help computing crc32c on SCTP packets
From: Davide Caratti @ 2017-05-16 16:27 UTC (permalink / raw)
To: linux-sctp, netdev
Cc: Alexander Duyck, Tom Herbert, David Laight, David S. Miller,
Marcelo Ricardo Leitner
In-Reply-To: <cover.1494946940.git.dcaratti@redhat.com>
sctp_compute_checksum requires crc32c symbol (provided by libcrc32c), so
it can't be used in net core. Like it has been done previously with other
symbols (e.g. ipv6_dst_lookup), introduce a stub struct skb_checksum_ops
to allow computation of crc32c checksum in net core after sctp.ko (and thus
libcrc32c) has been loaded.
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
include/linux/skbuff.h | 2 ++
net/core/skbuff.c | 24 ++++++++++++++++++++++++
net/sctp/offload.c | 7 +++++++
3 files changed, 33 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index a098d95..884a197 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3129,6 +3129,8 @@ struct skb_checksum_ops {
__wsum (*combine)(__wsum csum, __wsum csum2, int offset, int len);
};
+extern const struct skb_checksum_ops *crc32c_csum_stub __read_mostly;
+
__wsum __skb_checksum(const struct sk_buff *skb, int offset, int len,
__wsum csum, const struct skb_checksum_ops *ops);
__wsum skb_checksum(const struct sk_buff *skb, int offset, int len,
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 346d3e8..12e3cb7 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2243,6 +2243,30 @@ __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
}
EXPORT_SYMBOL(skb_copy_and_csum_bits);
+static __wsum warn_crc32c_csum_update(const void *buff, int len, __wsum sum)
+{
+ net_warn_ratelimited(
+ "%s: attempt to compute crc32c without libcrc32c.ko\n",
+ __func__);
+ return 0;
+}
+
+static __wsum warn_crc32c_csum_combine(__wsum csum, __wsum csum2,
+ int offset, int len)
+{
+ net_warn_ratelimited(
+ "%s: attempt to compute crc32c without libcrc32c.ko\n",
+ __func__);
+ return 0;
+}
+
+const struct skb_checksum_ops *crc32c_csum_stub __read_mostly =
+ &(struct skb_checksum_ops) {
+ .update = warn_crc32c_csum_update,
+ .combine = warn_crc32c_csum_combine,
+};
+EXPORT_SYMBOL(crc32c_csum_stub);
+
/**
* skb_zerocopy_headlen - Calculate headroom needed for skb_zerocopy()
* @from: source buffer
diff --git a/net/sctp/offload.c b/net/sctp/offload.c
index 4f5a2b5..378f462 100644
--- a/net/sctp/offload.c
+++ b/net/sctp/offload.c
@@ -98,6 +98,12 @@ static const struct net_offload sctp6_offload = {
},
};
+static const struct skb_checksum_ops *crc32c_csum_ops __read_mostly =
+ &(struct skb_checksum_ops) {
+ .update = sctp_csum_update,
+ .combine = sctp_csum_combine,
+};
+
int __init sctp_offload_init(void)
{
int ret;
@@ -110,6 +116,7 @@ int __init sctp_offload_init(void)
if (ret)
goto ipv4;
+ crc32c_csum_stub = crc32c_csum_ops;
return ret;
ipv4:
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v2 4/7] net: use skb->csum_not_inet to identify packets needing crc32c
From: Davide Caratti @ 2017-05-16 16:27 UTC (permalink / raw)
To: linux-sctp, netdev
Cc: Alexander Duyck, Tom Herbert, David Laight, David S. Miller,
Marcelo Ricardo Leitner
In-Reply-To: <cover.1494946940.git.dcaratti@redhat.com>
skb->csum_not_inet carries the indication on which algorithm is needed to
compute checksum on skb in the transmit path, when skb->ip_summed is equal
to CHECKSUM_PARTIAL. If skb carries a SCTP packet and crc32c hasn't been
yet written in L4 header, skb->csum_not_inet is assigned to 1; otherwise,
assume Internet Checksum is needed and thus set skb->csum_not_inet to 0.
Suggested-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Tom Herbert <tom@herbertland.com>
---
include/linux/skbuff.h | 16 +++++++++-------
net/core/dev.c | 1 +
net/sched/act_csum.c | 1 +
net/sctp/offload.c | 1 +
net/sctp/output.c | 1 +
5 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f98e3a6..2fefd92 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -189,12 +189,13 @@
*
* NETIF_F_SCTP_CRC - This feature indicates that a device is capable of
* offloading the SCTP CRC in a packet. To perform this offload the stack
- * will set ip_summed to CHECKSUM_PARTIAL and set csum_start and csum_offset
- * accordingly. Note the there is no indication in the skbuff that the
- * CHECKSUM_PARTIAL refers to an SCTP checksum, a driver that supports
- * both IP checksum offload and SCTP CRC offload must verify which offload
- * is configured for a packet presumably by inspecting packet headers; in
- * case, skb_crc32c_csum_help is provided to compute CRC on SCTP packets.
+ * will set set csum_start and csum_offset accordingly, set ip_summed to
+ * CHECKSUM_PARTIAL and set csum_not_inet to 1, to provide an indication in
+ * the skbuff that the CHECKSUM_PARTIAL refers to CRC32c.
+ * A driver that supports both IP checksum offload and SCTP CRC32c offload
+ * must verify which offload is configured for a packet by testing the
+ * value of skb->csum_not_inet; skb_crc32c_csum_help is provided to resolve
+ * CHECKSUM_PARTIAL on skbs where csum_not_inet is set to 1.
*
* NETIF_F_FCOE_CRC - This feature indicates that a device is capable of
* offloading the FCOE CRC in a packet. To perform this offload the stack
@@ -617,6 +618,7 @@ static inline bool skb_mstamp_after(const struct skb_mstamp *t1,
* @wifi_acked_valid: wifi_acked was set
* @wifi_acked: whether frame was acked on wifi or not
* @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
+ * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL
* @dst_pending_confirm: need to confirm neighbour
* @napi_id: id of the NAPI struct this skb came from
* @secmark: security marking
@@ -745,7 +747,7 @@ struct sk_buff {
__u8 csum_valid:1;
__u8 csum_complete_sw:1;
__u8 csum_level:2;
- __u8 __csum_bad_unused:1; /* one bit hole */
+ __u8 csum_not_inet:1;
__u8 dst_pending_confirm:1;
#ifdef CONFIG_IPV6_NDISC_NODETYPE
diff --git a/net/core/dev.c b/net/core/dev.c
index 1b9575c..2cedb0f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2647,6 +2647,7 @@ int skb_crc32c_csum_help(struct sk_buff *skb)
crc32c_csum_stub));
*(__le32 *)(skb->data + offset) = crc32c_csum;
skb->ip_summed = CHECKSUM_NONE;
+ skb->csum_not_inet = 0;
out:
return ret;
}
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index ab6fdbd..3317a2f 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -350,6 +350,7 @@ static int tcf_csum_sctp(struct sk_buff *skb, unsigned int ihl,
sctph->checksum = sctp_compute_cksum(skb,
skb_network_offset(skb) + ihl);
skb->ip_summed = CHECKSUM_NONE;
+ skb->csum_not_inet = 0;
return 1;
}
diff --git a/net/sctp/offload.c b/net/sctp/offload.c
index 378f462..ef156ac 100644
--- a/net/sctp/offload.c
+++ b/net/sctp/offload.c
@@ -35,6 +35,7 @@
static __le32 sctp_gso_make_checksum(struct sk_buff *skb)
{
skb->ip_summed = CHECKSUM_NONE;
+ skb->csum_not_inet = 0;
return sctp_compute_cksum(skb, skb_transport_offset(skb));
}
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 1409a87..e2edf2e 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -538,6 +538,7 @@ static int sctp_packet_pack(struct sctp_packet *packet,
} else {
chksum:
head->ip_summed = CHECKSUM_PARTIAL;
+ head->csum_not_inet = 1;
head->csum_start = skb_transport_header(head) - head->head;
head->csum_offset = offsetof(struct sctphdr, checksum);
}
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v2 5/7] net: more accurate checksumming in validate_xmit_skb()
From: Davide Caratti @ 2017-05-16 16:27 UTC (permalink / raw)
To: linux-sctp, netdev
Cc: Alexander Duyck, Tom Herbert, David Laight, David S. Miller,
Marcelo Ricardo Leitner
In-Reply-To: <cover.1494946940.git.dcaratti@redhat.com>
skb_csum_hwoffload_help() uses netdev features and skb->csum_not_inet to
determine if skb needs software computation of Internet Checksum or crc32c
(or nothing, if this computation can be done by the hardware). Use it in
place of skb_checksum_help() in validate_xmit_skb() to avoid corruption
of non-GSO SCTP packets having skb->ip_summed equal to CHECKSUM_PARTIAL.
While at it, remove references to skb_csum_off_chk* functions, since they
are not present anymore in Linux _ see commit cf53b1da73bd ("Revert
"net: Add driver helper functions to determine checksum offloadability"").
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
Documentation/networking/checksum-offloads.txt | 11 +++++++----
include/linux/netdevice.h | 3 +++
include/linux/skbuff.h | 13 +++++--------
net/core/dev.c | 14 ++++++++++++--
4 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/Documentation/networking/checksum-offloads.txt b/Documentation/networking/checksum-offloads.txt
index 56e3686..d52d191 100644
--- a/Documentation/networking/checksum-offloads.txt
+++ b/Documentation/networking/checksum-offloads.txt
@@ -35,6 +35,9 @@ This interface only allows a single checksum to be offloaded. Where
encapsulation is used, the packet may have multiple checksum fields in
different header layers, and the rest will have to be handled by another
mechanism such as LCO or RCO.
+CRC32c can also be offloaded using this interface, by means of filling
+ skb->csum_start and skb->csum_offset as described above, and setting
+ skb->csum_not_inet: see skbuff.h comment (section 'D') for more details.
No offloading of the IP header checksum is performed; it is always done in
software. This is OK because when we build the IP header, we obviously
have it in cache, so summing it isn't expensive. It's also rather short.
@@ -49,9 +52,9 @@ A driver declares its offload capabilities in netdev->hw_features; see
and csum_offset given in the SKB; if it tries to deduce these itself in
hardware (as some NICs do) the driver should check that the values in the
SKB match those which the hardware will deduce, and if not, fall back to
- checksumming in software instead (with skb_checksum_help or one of the
- skb_csum_off_chk* functions as mentioned in include/linux/skbuff.h). This
- is a pain, but that's what you get when hardware tries to be clever.
+ checksumming in software instead (with skb_csum_hwoffload_help() or one of
+ the skb_checksum_help() / skb_crc32c_csum_help functions, as mentioned in
+ include/linux/skbuff.h).
The stack should, for the most part, assume that checksum offload is
supported by the underlying device. The only place that should check is
@@ -60,7 +63,7 @@ The stack should, for the most part, assume that checksum offload is
may include other offloads besides TX Checksum Offload) and, if they are
not supported or enabled on the device (determined by netdev->features),
performs the corresponding offload in software. In the case of TX
- Checksum Offload, that means calling skb_checksum_help(skb).
+ Checksum Offload, that means calling skb_csum_hwoffload_help(skb, features).
LCO: Local Checksum Offload
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f168edb..3e454f2 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3926,6 +3926,9 @@ void netdev_rss_key_fill(void *buffer, size_t len);
int dev_get_nest_level(struct net_device *dev);
int skb_checksum_help(struct sk_buff *skb);
int skb_crc32c_csum_help(struct sk_buff *skb);
+int skb_csum_hwoffload_help(struct sk_buff *skb,
+ const netdev_features_t features);
+
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
netdev_features_t features, bool tx_path);
struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2fefd92..fe109fa 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -162,14 +162,11 @@
*
* NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are being deprecated in favor of
* NETIF_F_HW_CSUM. New devices should use NETIF_F_HW_CSUM to indicate
- * checksum offload capability. If a device has limited checksum capabilities
- * (for instance can only perform NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM as
- * described above) a helper function can be called to resolve
- * CHECKSUM_PARTIAL. The helper functions are skb_csum_off_chk*. The helper
- * function takes a spec argument that describes the protocol layer that is
- * supported for checksum offload and can be called for each packet. If a
- * packet does not match the specification for offload, skb_checksum_help
- * is called to resolve the checksum.
+ * checksum offload capability.
+ * skb_csum_hwoffload_help() can be called to resolve CHECKSUM_PARTIAL based
+ * on network device checksumming capabilities: if a packet does not match
+ * them, skb_checksum_help or skb_crc32c_help (depending on the value of
+ * csum_not_inet, see item D.) is called to resolve the checksum.
*
* CHECKSUM_NONE:
*
diff --git a/net/core/dev.c b/net/core/dev.c
index 2cedb0f..242c055 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2994,6 +2994,17 @@ static struct sk_buff *validate_xmit_vlan(struct sk_buff *skb,
return skb;
}
+int skb_csum_hwoffload_help(struct sk_buff *skb,
+ const netdev_features_t features)
+{
+ if (unlikely(skb->csum_not_inet))
+ return !!(features & NETIF_F_SCTP_CRC) ? 0 :
+ skb_crc32c_csum_help(skb);
+
+ return !!(features & NETIF_F_CSUM_MASK) ? 0 : skb_checksum_help(skb);
+}
+EXPORT_SYMBOL(skb_csum_hwoffload_help);
+
static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device *dev)
{
netdev_features_t features;
@@ -3032,8 +3043,7 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
else
skb_set_transport_header(skb,
skb_checksum_start_offset(skb));
- if (!(features & NETIF_F_CSUM_MASK) &&
- skb_checksum_help(skb))
+ if (skb_csum_hwoffload_help(skb, features))
goto out_kfree_skb;
}
}
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v2 2/7] net: introduce skb_crc32c_csum_help
From: Davide Caratti @ 2017-05-16 16:27 UTC (permalink / raw)
To: linux-sctp, netdev
Cc: Alexander Duyck, Tom Herbert, David Laight, David S. Miller,
Marcelo Ricardo Leitner
In-Reply-To: <cover.1494946940.git.dcaratti@redhat.com>
skb_crc32c_csum_help is like skb_checksum_help, but it is designed for
checksumming SCTP packets using crc32c (see RFC3309), provided that
libcrc32c.ko has been loaded before. In case libcrc32c is not loaded,
invoking skb_crc32c_csum_help on a skb results in one the following
printouts:
warn_crc32c_csum_update: attempt to compute crc32c without libcrc32c.ko
warn_crc32c_csum_combine: attempt to compute crc32c without libcrc32c.ko
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
include/linux/netdevice.h | 1 +
include/linux/skbuff.h | 3 ++-
net/core/dev.c | 41 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9c23bd2..8e771f1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3927,6 +3927,7 @@ void netdev_rss_key_fill(void *buffer, size_t len);
int dev_get_nest_level(struct net_device *dev);
int skb_checksum_help(struct sk_buff *skb);
+int skb_crc32c_csum_help(struct sk_buff *skb);
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
netdev_features_t features, bool tx_path);
struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 884a197..f3cfaaf 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -193,7 +193,8 @@
* accordingly. Note the there is no indication in the skbuff that the
* CHECKSUM_PARTIAL refers to an SCTP checksum, a driver that supports
* both IP checksum offload and SCTP CRC offload must verify which offload
- * is configured for a packet presumably by inspecting packet headers.
+ * is configured for a packet presumably by inspecting packet headers; in
+ * case, skb_crc32c_csum_help is provided to compute CRC on SCTP packets.
*
* NETIF_F_FCOE_CRC - This feature indicates that a device is capable of
* offloading the FCOE CRC in a packet. To perform this offload the stack
diff --git a/net/core/dev.c b/net/core/dev.c
index d07aa5f..702ed50 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -141,6 +141,7 @@
#include <linux/hrtimer.h>
#include <linux/netfilter_ingress.h>
#include <linux/crash_dump.h>
+#include <linux/sctp.h>
#include "net-sysfs.h"
@@ -2610,6 +2611,46 @@ int skb_checksum_help(struct sk_buff *skb)
}
EXPORT_SYMBOL(skb_checksum_help);
+int skb_crc32c_csum_help(struct sk_buff *skb)
+{
+ __le32 crc32c_csum;
+ int ret = 0, offset, start;
+
+ if (skb->ip_summed != CHECKSUM_PARTIAL)
+ goto out;
+
+ if (unlikely(skb_is_gso(skb)))
+ goto out;
+
+ /* Before computing a checksum, we should make sure no frag could
+ * be modified by an external entity : checksum could be wrong.
+ */
+ if (unlikely(skb_has_shared_frag(skb))) {
+ ret = __skb_linearize(skb);
+ if (ret)
+ goto out;
+ }
+ start = skb_checksum_start_offset(skb);
+ offset = start + offsetof(struct sctphdr, checksum);
+ if (WARN_ON_ONCE(offset >= skb_headlen(skb))) {
+ ret = -EINVAL;
+ goto out;
+ }
+ if (skb_cloned(skb) &&
+ !skb_clone_writable(skb, offset + sizeof(__le32))) {
+ ret = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
+ if (ret)
+ goto out;
+ }
+ crc32c_csum = cpu_to_le32(~__skb_checksum(skb, start,
+ skb->len - start, ~(__u32)0,
+ crc32c_csum_stub));
+ *(__le32 *)(skb->data + offset) = crc32c_csum;
+ skb->ip_summed = CHECKSUM_NONE;
+out:
+ return ret;
+}
+
__be16 skb_network_protocol(struct sk_buff *skb, int *depth)
{
__be16 type = skb->protocol;
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v2 7/7] sk_buff.h: improve description of CHECKSUM_{COMPLETE,UNNECESSARY}
From: Davide Caratti @ 2017-05-16 16:27 UTC (permalink / raw)
To: linux-sctp, netdev
Cc: Alexander Duyck, Tom Herbert, David Laight, David S. Miller,
Marcelo Ricardo Leitner
In-Reply-To: <cover.1494946940.git.dcaratti@redhat.com>
Add FCoE to the list of protocols that can set CHECKSUM_UNNECESSARY; add a
note to CHECKSUM_COMPLETE section to specify that it does not apply to SCTP
and FCoE protocols.
Suggested-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Acked-by: Tom Herbert <tom@herbertland.com>
---
include/linux/skbuff.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index fe109fa..5a082db 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -109,6 +109,7 @@
* may perform further validation in this case.
* GRE: only if the checksum is present in the header.
* SCTP: indicates the CRC in SCTP header has been validated.
+ * FCOE: indicates the CRC in FC frame has been validated.
*
* skb->csum_level indicates the number of consecutive checksums found in
* the packet minus one that have been verified as CHECKSUM_UNNECESSARY.
@@ -126,8 +127,10 @@
* packet as seen by netif_rx() and fills out in skb->csum. Meaning, the
* hardware doesn't need to parse L3/L4 headers to implement this.
*
- * Note: Even if device supports only some protocols, but is able to produce
- * skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY.
+ * Notes:
+ * - Even if device supports only some protocols, but is able to produce
+ * skb->csum, it MUST use CHECKSUM_COMPLETE, not CHECKSUM_UNNECESSARY.
+ * - CHECKSUM_COMPLETE is not applicable to SCTP and FCoE protocols.
*
* CHECKSUM_PARTIAL:
*
--
2.7.4
^ permalink raw reply related
* [PATCH net-next v2 3/7] sk_buff: remove support for csum_bad in sk_buff
From: Davide Caratti @ 2017-05-16 16:27 UTC (permalink / raw)
To: linux-sctp, netdev
Cc: Alexander Duyck, Tom Herbert, David Laight, David S. Miller,
Marcelo Ricardo Leitner
In-Reply-To: <cover.1494946940.git.dcaratti@redhat.com>
This bit was introduced with commit 5a21232983aa ("net: Support for
csum_bad in skbuff") to reduce the stack workload when processing RX
packets carrying a wrong Internet Checksum. Up to now, only one driver and
GRO core are setting it.
Suggested-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 2 +-
include/linux/netdevice.h | 4 +---
include/linux/skbuff.h | 23 ++---------------------
net/bridge/netfilter/nft_reject_bridge.c | 5 +----
net/core/dev.c | 3 ---
net/ipv4/netfilter/nf_reject_ipv4.c | 2 +-
net/ipv6/netfilter/nf_reject_ipv6.c | 3 ---
7 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
index 3a8a4aa..9a08179 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
@@ -223,7 +223,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self, int *work_done, int budget)
skb->protocol = eth_type_trans(skb, ndev);
if (unlikely(buff->is_cso_err)) {
++self->stats.rx.errors;
- __skb_mark_checksum_bad(skb);
+ skb->ip_summed = CHECKSUM_NONE;
} else {
if (buff->is_ip_cso) {
__skb_incr_checksum_unnecessary(skb);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8e771f1..f168edb 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2573,9 +2573,7 @@ static inline void skb_gro_incr_csum_unnecessary(struct sk_buff *skb)
if (__skb_gro_checksum_validate_needed(skb, zero_okay, check)) \
__ret = __skb_gro_checksum_validate_complete(skb, \
compute_pseudo(skb, proto)); \
- if (__ret) \
- __skb_mark_checksum_bad(skb); \
- else \
+ if (!__ret) \
skb_gro_incr_csum_unnecessary(skb); \
__ret; \
})
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f3cfaaf..f98e3a6 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -745,7 +745,7 @@ struct sk_buff {
__u8 csum_valid:1;
__u8 csum_complete_sw:1;
__u8 csum_level:2;
- __u8 csum_bad:1;
+ __u8 __csum_bad_unused:1; /* one bit hole */
__u8 dst_pending_confirm:1;
#ifdef CONFIG_IPV6_NDISC_NODETYPE
@@ -3389,21 +3389,6 @@ static inline void __skb_incr_checksum_unnecessary(struct sk_buff *skb)
}
}
-static inline void __skb_mark_checksum_bad(struct sk_buff *skb)
-{
- /* Mark current checksum as bad (typically called from GRO
- * path). In the case that ip_summed is CHECKSUM_NONE
- * this must be the first checksum encountered in the packet.
- * When ip_summed is CHECKSUM_UNNECESSARY, this is the first
- * checksum after the last one validated. For UDP, a zero
- * checksum can not be marked as bad.
- */
-
- if (skb->ip_summed == CHECKSUM_NONE ||
- skb->ip_summed == CHECKSUM_UNNECESSARY)
- skb->csum_bad = 1;
-}
-
/* Check if we need to perform checksum complete validation.
*
* Returns true if checksum complete is needed, false otherwise
@@ -3457,9 +3442,6 @@ static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb,
skb->csum_valid = 1;
return 0;
}
- } else if (skb->csum_bad) {
- /* ip_summed == CHECKSUM_NONE in this case */
- return (__force __sum16)1;
}
skb->csum = psum;
@@ -3519,8 +3501,7 @@ static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
{
- return (skb->ip_summed == CHECKSUM_NONE &&
- skb->csum_valid && !skb->csum_bad);
+ return (skb->ip_summed == CHECKSUM_NONE && skb->csum_valid);
}
static inline void __skb_checksum_convert(struct sk_buff *skb,
diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c
index 346ef6b..c16dd3a 100644
--- a/net/bridge/netfilter/nft_reject_bridge.c
+++ b/net/bridge/netfilter/nft_reject_bridge.c
@@ -111,7 +111,7 @@ static void nft_reject_br_send_v4_unreach(struct net *net,
__wsum csum;
u8 proto;
- if (oldskb->csum_bad || !nft_bridge_iphdr_validate(oldskb))
+ if (!nft_bridge_iphdr_validate(oldskb))
return;
/* IP header checks: fragment. */
@@ -226,9 +226,6 @@ static bool reject6_br_csum_ok(struct sk_buff *skb, int hook)
__be16 fo;
u8 proto = ip6h->nexthdr;
- if (skb->csum_bad)
- return false;
-
if (skb_csum_unnecessary(skb))
return true;
diff --git a/net/core/dev.c b/net/core/dev.c
index 702ed50..1b9575c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4676,9 +4676,6 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
if (netif_elide_gro(skb->dev))
goto normal;
- if (skb->csum_bad)
- goto normal;
-
gro_list_prepare(napi, skb);
rcu_read_lock();
diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c
index 7cd8d0d..6f8d9e5 100644
--- a/net/ipv4/netfilter/nf_reject_ipv4.c
+++ b/net/ipv4/netfilter/nf_reject_ipv4.c
@@ -172,7 +172,7 @@ void nf_send_unreach(struct sk_buff *skb_in, int code, int hook)
struct iphdr *iph = ip_hdr(skb_in);
u8 proto;
- if (skb_in->csum_bad || iph->frag_off & htons(IP_OFFSET))
+ if (iph->frag_off & htons(IP_OFFSET))
return;
if (skb_csum_unnecessary(skb_in)) {
diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c
index eedee5d..f63b18e 100644
--- a/net/ipv6/netfilter/nf_reject_ipv6.c
+++ b/net/ipv6/netfilter/nf_reject_ipv6.c
@@ -220,9 +220,6 @@ static bool reject6_csum_ok(struct sk_buff *skb, int hook)
__be16 fo;
u8 proto;
- if (skb->csum_bad)
- return false;
-
if (skb_csum_unnecessary(skb))
return true;
--
2.7.4
^ permalink raw reply related
* [PATCH] net: phy: Remove residual magic from PHY drivers
From: Andrew Lunn @ 2017-05-16 16:29 UTC (permalink / raw)
To: David Miller; +Cc: Florian Fainelli, netdev, Andrew Lunn
commit fa8cddaf903c ("net phylib: Remove unnecessary condition check in phy")
removed the only place where the PHY flag PHY_HAS_MAGICANEG was
checked. But it left the flag being set in the drivers. Remove the flag.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/broadcom.c | 30 +++++++++++++++---------------
drivers/net/phy/micrel.c | 27 +++++++++++++--------------
drivers/net/phy/microchip.c | 2 +-
drivers/net/phy/smsc.c | 12 ++++++------
include/linux/phy.h | 3 +--
5 files changed, 36 insertions(+), 38 deletions(-)
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index a32dc5d11e89..1e9ad30a35c8 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -540,7 +540,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5411",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -551,7 +551,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5421",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -562,7 +562,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM54210E",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -573,7 +573,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5461",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -584,7 +584,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM54612E",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -595,7 +595,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM54616S",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -606,7 +606,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5464",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -617,7 +617,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5481",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = bcm5481_config_aneg,
.read_status = genphy_read_status,
@@ -628,7 +628,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM54810",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = bcm5481_config_aneg,
.read_status = genphy_read_status,
@@ -639,7 +639,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5482",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm5482_config_init,
.config_aneg = genphy_config_aneg,
.read_status = bcm5482_read_status,
@@ -650,7 +650,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM50610",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -661,7 +661,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM50610M",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -672,7 +672,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM57780",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = bcm54xx_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -683,7 +683,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCMAC131",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = brcm_fet_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -694,7 +694,7 @@ static struct phy_driver broadcom_drivers[] = {
.phy_id_mask = 0xfffffff0,
.name = "Broadcom BCM5241",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = brcm_fet_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 6a5fd18f062c..4cfd54182da2 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -779,7 +779,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = MICREL_PHY_ID_MASK,
.name = "Micrel KS8737",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ks8737_type,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
@@ -793,7 +793,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = 0x00ffffff,
.name = "Micrel KSZ8021 or KSZ8031",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ksz8021_type,
.probe = kszphy_probe,
.config_init = kszphy_config_init,
@@ -811,7 +811,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = 0x00ffffff,
.name = "Micrel KSZ8031",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ksz8021_type,
.probe = kszphy_probe,
.config_init = kszphy_config_init,
@@ -829,7 +829,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = MICREL_PHY_ID_MASK,
.name = "Micrel KSZ8041",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ksz8041_type,
.probe = kszphy_probe,
.config_init = ksz8041_config_init,
@@ -847,7 +847,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = MICREL_PHY_ID_MASK,
.name = "Micrel KSZ8041RNLI",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ksz8041_type,
.probe = kszphy_probe,
.config_init = kszphy_config_init,
@@ -865,7 +865,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = MICREL_PHY_ID_MASK,
.name = "Micrel KSZ8051",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ksz8051_type,
.probe = kszphy_probe,
.config_init = kszphy_config_init,
@@ -883,7 +883,7 @@ static struct phy_driver ksphy_driver[] = {
.name = "Micrel KSZ8001 or KS8721",
.phy_id_mask = 0x00fffffc,
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ksz8041_type,
.probe = kszphy_probe,
.config_init = kszphy_config_init,
@@ -901,7 +901,7 @@ static struct phy_driver ksphy_driver[] = {
.name = "Micrel KSZ8081 or KSZ8091",
.phy_id_mask = MICREL_PHY_ID_MASK,
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ksz8081_type,
.probe = kszphy_probe,
.config_init = kszphy_config_init,
@@ -919,7 +919,7 @@ static struct phy_driver ksphy_driver[] = {
.name = "Micrel KSZ8061",
.phy_id_mask = MICREL_PHY_ID_MASK,
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -932,7 +932,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = 0x000ffffe,
.name = "Micrel KSZ9021 Gigabit PHY",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ksz9021_type,
.probe = kszphy_probe,
.config_init = ksz9021_config_init,
@@ -952,7 +952,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = MICREL_PHY_ID_MASK,
.name = "Micrel KSZ9031 Gigabit PHY",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.driver_data = &ksz9021_type,
.probe = kszphy_probe,
.config_init = ksz9031_config_init,
@@ -969,7 +969,6 @@ static struct phy_driver ksphy_driver[] = {
.phy_id = PHY_ID_KSZ8873MLL,
.phy_id_mask = MICREL_PHY_ID_MASK,
.name = "Micrel KSZ8873MLL Switch",
- .flags = PHY_HAS_MAGICANEG,
.config_init = kszphy_config_init,
.config_aneg = ksz8873mll_config_aneg,
.read_status = ksz8873mll_read_status,
@@ -980,7 +979,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = MICREL_PHY_ID_MASK,
.name = "Micrel KSZ886X Switch",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
@@ -991,7 +990,7 @@ static struct phy_driver ksphy_driver[] = {
.phy_id_mask = MICREL_PHY_ID_MASK,
.name = "Micrel KSZ8795",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
+ .flags = PHY_HAS_INTERRUPT,
.config_init = kszphy_config_init,
.config_aneg = ksz8873mll_config_aneg,
.read_status = ksz8873mll_read_status,
diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c
index 2b2f543cf9f0..37ee856c7680 100644
--- a/drivers/net/phy/microchip.c
+++ b/drivers/net/phy/microchip.c
@@ -146,7 +146,7 @@ static struct phy_driver microchip_phy_driver[] = {
.name = "Microchip LAN88xx",
.features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG,
+ .flags = PHY_HAS_INTERRUPT,
.probe = lan88xx_probe,
.remove = lan88xx_remove,
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index cef6967b0396..67c9f2b26c8e 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -170,7 +170,7 @@ static struct phy_driver smsc_phy_driver[] = {
.name = "SMSC LAN83C185",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG,
+ .flags = PHY_HAS_INTERRUPT,
.probe = smsc_phy_probe,
@@ -192,7 +192,7 @@ static struct phy_driver smsc_phy_driver[] = {
.name = "SMSC LAN8187",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG,
+ .flags = PHY_HAS_INTERRUPT,
.probe = smsc_phy_probe,
@@ -214,7 +214,7 @@ static struct phy_driver smsc_phy_driver[] = {
.name = "SMSC LAN8700",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG,
+ .flags = PHY_HAS_INTERRUPT,
.probe = smsc_phy_probe,
@@ -236,7 +236,7 @@ static struct phy_driver smsc_phy_driver[] = {
.name = "SMSC LAN911x Internal PHY",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG,
+ .flags = PHY_HAS_INTERRUPT,
.probe = smsc_phy_probe,
@@ -257,7 +257,7 @@ static struct phy_driver smsc_phy_driver[] = {
.name = "SMSC LAN8710/LAN8720",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG,
+ .flags = PHY_HAS_INTERRUPT,
.probe = smsc_phy_probe,
@@ -279,7 +279,7 @@ static struct phy_driver smsc_phy_driver[] = {
.name = "SMSC LAN8740",
.features = PHY_BASIC_FEATURES,
- .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG,
+ .flags = PHY_HAS_INTERRUPT,
.probe = smsc_phy_probe,
diff --git a/include/linux/phy.h b/include/linux/phy.h
index e76e4adbc7c7..54ef45823fc1 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -58,8 +58,7 @@
#define PHY_IGNORE_INTERRUPT -2
#define PHY_HAS_INTERRUPT 0x00000001
-#define PHY_HAS_MAGICANEG 0x00000002
-#define PHY_IS_INTERNAL 0x00000004
+#define PHY_IS_INTERNAL 0x00000002
#define MDIO_DEVICE_IS_PHY 0x80000000
/* Interface Mode definitions */
--
2.11.0
^ permalink raw reply related
* [PATCH net-next v2 6/7] openvswitch: more accurate checksumming in queue_userspace_packet()
From: Davide Caratti @ 2017-05-16 16:27 UTC (permalink / raw)
To: linux-sctp, netdev
Cc: Alexander Duyck, Tom Herbert, David Laight, David S. Miller,
Marcelo Ricardo Leitner
In-Reply-To: <cover.1494946940.git.dcaratti@redhat.com>
if skb carries an SCTP packet and ip_summed is CHECKSUM_PARTIAL, it needs
CRC32c in place of Internet Checksum: use skb_csum_hwoffload_help to avoid
corrupting such packets while queueing them towards userspace.
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
---
net/openvswitch/datapath.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 7b17da9..9ddc9f8 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -453,7 +453,7 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
/* Complete checksum if needed */
if (skb->ip_summed == CHECKSUM_PARTIAL &&
- (err = skb_checksum_help(skb)))
+ (err = skb_csum_hwoffload_help(skb, 0)))
goto out;
/* Older versions of OVS user space enforce alignment of the last
--
2.7.4
^ permalink raw reply related
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: Christoph Hellwig @ 2017-05-16 16:30 UTC (permalink / raw)
To: David Miller
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, hch-jcswGhMUV9g,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
stable-u79uwXL29TY76Z2rM5mHXA,
ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
In-Reply-To: <20170516.122923.869994491617365845.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
On Tue, May 16, 2017 at 12:29:23PM -0400, David Miller wrote:
> I can't push back on people with silly coding style and small semantic
> issues forever. And I think I made a serious effort to keep the
> patches getting posted over and over again to make sure they got more
> exposure.
You can tell them to go to linux-rdma. I'm sending people to the right
mailing list all the time.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: David Miller @ 2017-05-16 16:33 UTC (permalink / raw)
To: hch-jcswGhMUV9g
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
stable-u79uwXL29TY76Z2rM5mHXA,
ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
In-Reply-To: <20170516163041.GA5132-jcswGhMUV9g@public.gmane.org>
From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Date: Tue, 16 May 2017 18:30:41 +0200
> On Tue, May 16, 2017 at 12:29:23PM -0400, David Miller wrote:
>> I can't push back on people with silly coding style and small semantic
>> issues forever. And I think I made a serious effort to keep the
>> patches getting posted over and over again to make sure they got more
>> exposure.
>
> You can tell them to go to linux-rdma. I'm sending people to the right
> mailing list all the time.
That doesn't cover things that don't directly touch the RDMA code or
infiniband infrastructure.
There should have been RDMA people on netdev who saw this thing and
cried wolf, and they would have had about an entire year, and about
8 instances of this series being posted in which to do so.
It's not like this got posted once or twice and went in with zero
review.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: Christoph Hellwig @ 2017-05-16 16:35 UTC (permalink / raw)
To: David Miller
Cc: hch, dledford, Bart.VanAssche, torvalds, netdev, linux-rdma,
stable, ubraun
In-Reply-To: <20170516.123308.2059131411772131424.davem@davemloft.net>
On Tue, May 16, 2017 at 12:33:08PM -0400, David Miller wrote:
> That doesn't cover things that don't directly touch the RDMA code or
> infiniband infrastructure.
>
> There should have been RDMA people on netdev who saw this thing and
> cried wolf, and they would have had about an entire year, and about
> 8 instances of this series being posted in which to do so.
>
> It's not like this got posted once or twice and went in with zero
> review.
None outside of netdev. Really, if you get rdma patches include
linux-rdma. Or at least linux-kernel where I will usually catch
this sort of stuff. netdev is too high traffic and too far away
from my area of work to watch it.
But for example when I wrote my first RDMA ULP I did subsribe
to linux-rdma, started extensive discussions and fixed up lots
of core code. There is no excuse for other people to not even
try.
^ permalink raw reply
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: Doug Ledford @ 2017-05-16 16:36 UTC (permalink / raw)
To: Christoph Hellwig, David Miller
Cc: Bart.VanAssche-XdAiOPVOjttBDgjK7y7TUQ,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
stable-u79uwXL29TY76Z2rM5mHXA,
ubraun-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8
In-Reply-To: <20170516163041.GA5132-jcswGhMUV9g@public.gmane.org>
On Tue, 2017-05-16 at 18:30 +0200, Christoph Hellwig wrote:
> On Tue, May 16, 2017 at 12:29:23PM -0400, David Miller wrote:
> >
> > I can't push back on people with silly coding style and small
> > semantic
> > issues forever. And I think I made a serious effort to keep the
> > patches getting posted over and over again to make sure they got
> > more
> > exposure.
>
> You can tell them to go to linux-rdma. I'm sending people to the
> right
> mailing list all the time.
Indeed. Every single time a patch comes into linux-rdma that touches
things in net/ or include/net, unless it is exceedingly minor, I check
the To:/Cc: lines on the email and if netdev@ isn't included, or in the
case of complex/tricky items, you aren't directly Cc:ed, then I
specifically tell them to include netdev@ and/or you. I've even had
things like a 12 patch series that buried three netdev@ appropriate
patches at different points in the series and told the submitter to
move all of the netdev@ related patches to the front and submit them to
netdev@ so they can be reviewed as a group before I would move on to
the others. It's just what you do. I've always considered that part
of my job.
--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
GPG KeyID: B826A3330E572FDD
Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [RFC] iproute: Add support for extended ack to rtnl_talk
From: Stephen Hemminger @ 2017-05-16 16:36 UTC (permalink / raw)
To: David Ahern; +Cc: Phil Sutter, David Miller, daniel, netdev
In-Reply-To: <f847c8d4-a6c0-66ab-0ac0-d83d6ea96a00@gmail.com>
On Sat, 13 May 2017 19:29:57 -0600
David Ahern <dsahern@gmail.com> wrote:
> On 5/4/17 2:43 PM, Phil Sutter wrote:
> > So in summary, given that very little change happens to iproute2's
> > internal libnetlink, I don't see much urge to make it use libmnl as
> > backend. In my opinion it just adds another potential source of errors.
> >
> > Eventually this should be a maintainer level decision, though. :)
>
> What is the decision on this?
I am waiting for a longer before committing anything. This was to allow
for a wider range of distribution maintainer feedback.
The most likely outcome is that for 4.12 is to use libmnl for extended ack.
And continue to support building without mnl with loss of functionality.
As far as conversion of all of iproute2 to libmnl. I have better things
to do... But for new functionality like extended ack, devlink, tipc, using
libmnl is easy, safe and it works well. I will continue to not accept
new code that depends on the other library (libnl). That has come up
a couple of times.
^ permalink raw reply
* Re: [PATCH 1/2] net-next: stmmac: add adjust_link function
From: David Miller @ 2017-05-16 16:38 UTC (permalink / raw)
To: clabbe.montjoie; +Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel
In-Reply-To: <20170515114140.1676-1-clabbe.montjoie@gmail.com>
From: Corentin Labbe <clabbe.montjoie@gmail.com>
Date: Mon, 15 May 2017 13:41:39 +0200
> My dwmac-sun8i serie will add some if (has_sun8i) to
> stmmac_adjust_link()
> Since the current stmmac_adjust_link() alreaady have lots of if (has_gmac/gmac4),
> It is now better to create an adjust_link() function for each dwmac.
>
> So this patch add an adjust_link() function pointer, and move code out
> of stmmac_adjust_link to it.
>
> Removing in the process stmmac_mac_flow_ctrl/stmmac_hw_fix_mac_speed
> since there not used anymore.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
This will introduce crashes because you only added the adjust_link
method to one of the two stmmac_ops instances in
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
Furthermore, a patch series should always have a header posting
with subject of the format "[PATCH 0/N]: xxx" which describes at
a high level what the patch series does as a whole, how it is doing
it, and why it is doing it that way.
Thank you.
^ permalink raw reply
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: David Miller @ 2017-05-16 16:41 UTC (permalink / raw)
To: dledford
Cc: hch, Bart.VanAssche, torvalds, netdev, linux-rdma, stable, ubraun
In-Reply-To: <1494952561.3259.104.camel@redhat.com>
From: Doug Ledford <dledford@redhat.com>
Date: Tue, 16 May 2017 12:36:01 -0400
> On Tue, 2017-05-16 at 18:30 +0200, Christoph Hellwig wrote:
>> On Tue, May 16, 2017 at 12:29:23PM -0400, David Miller wrote:
>> >
>> > I can't push back on people with silly coding style and small
>> > semantic
>> > issues forever. And I think I made a serious effort to keep the
>> > patches getting posted over and over again to make sure they got
>> > more
>> > exposure.
>>
>> You can tell them to go to linux-rdma. I'm sending people to the
>> right
>> mailing list all the time.
>
> Indeed. Every single time a patch comes into linux-rdma that touches
> things in net/ or include/net, unless it is exceedingly minor, I check
> the To:/Cc: lines on the email and if netdev@ isn't included, or in the
> case of complex/tricky items, you aren't directly Cc:ed, then I
> specifically tell them to include netdev@ and/or you. I've even had
> things like a 12 patch series that buried three netdev@ appropriate
> patches at different points in the series and told the submitter to
> move all of the netdev@ related patches to the front and submit them to
> netdev@ so they can be reviewed as a group before I would move on to
> the others. It's just what you do. I've always considered that part
> of my job.
To be quite honest it wasn't exceedingly clear, even to me, that this
had such implications or was directly a RDMA thing. From my
perspective while reviewing I saw a patch series adding it's own
protocol stack living inside of it's own directory under net/
And, if even one RDMA/infiniband person said to me "you really
shouldn't apply this" then I would have dropped it on the spot.
^ permalink raw reply
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: Doug Ledford @ 2017-05-16 16:42 UTC (permalink / raw)
To: David Miller
Cc: Bart.VanAssche, torvalds, hch, netdev, linux-rdma, stable, ubraun
In-Reply-To: <20170516.122923.869994491617365845.davem@davemloft.net>
On Tue, 2017-05-16 at 12:29 -0400, David Miller wrote:
> From: Doug Ledford <dledford@redhat.com>
> Date: Tue, 16 May 2017 11:57:04 -0400
>
> > Regardless though, I'm rather purturbed about this entire thing.
> If
> > you are right that because this got into 4.11, it's now a done
> deal,
> > then the fact that this went through 4 review cycles on netdev@
> that,
> > as I understand it, spanned roughly one years time, and not one
> single
> > person bothered to note that this was as much an RDMA driver as
> > anything else, and not one person bothered to note that linux-rdma@
> was
> > not on the Cc: list, and not one person told the submitters that
> they
> > needed to include linux-rdma@ on the Cc: list of these submissions,
> and
> > you took it without any review comments from any RDMA people in the
> > course of a year, or an ack from me to show that the RDMA portion
> of
> > this had at least been given some sort of review, was a collosal
> fuckup
> > of cross tree maintainer cooperation.
>
> We rely on people from various areas of expertiece to contribute to
> patch review on netdev and give appropriate feedback.
>
> If you actually look through the history, I made many semantic
> reviews
> of the SMC changes, and kept pushing back.
>
> And in fact I did this several times, making them go through several
> revisions, in the hopes that someone would review more of the meat
> and
> substance of the patch set.
If you want to walk to the mailbox, you walk to the mailbox, you don't
walk to the grocery store, to the gym, and never even go to the
mailbox. Likewise, if you want review from RDMA experts, most (maybe
even all) don't subscribe to netdev@ because it's too high traffic, you
don't waste time on silly semantic pushbacks, you send a single email
that says "Please get review from linux-rdma@, thank you." Don't beat
around the bush, be direct and get it over with. That's exactly what I
do for all netdev@ related patches coming to linux-rdma@ without a
proper Cc: to netdev@.
> Nobody do this for over a year.
>
> I can't push back on people with silly coding style and small
> semantic
> issues forever. And I think I made a serious effort to keep the
> patches getting posted over and over again to make sure they got more
> exposure.
>
> I think it's unsettling that there are no RDMA experts, or at least
> people remotely knowledgable about this "networking" technology,
> subscribed to netdev and taking a cursory look at pactches that might
> be relevant and effect that technology either directly or indirectly.
>
> So there is a lot of blame to go around.
Fine, allocate blame however, you like. What I want to actually settle
is how we are going to move forward. You didn't respond to that part
of my email. Your thoughts?
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: B826A3330E572FDD
Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
^ permalink raw reply
* Re: [PATCH 1/2] net-next: stmmac: add adjust_link function
From: Florian Fainelli @ 2017-05-16 16:43 UTC (permalink / raw)
To: Corentin Labbe, peppe.cavallaro, alexandre.torgue; +Cc: netdev, linux-kernel
In-Reply-To: <20170515114140.1676-1-clabbe.montjoie@gmail.com>
On 05/15/2017 04:41 AM, Corentin Labbe wrote:
> My dwmac-sun8i serie will add some if (has_sun8i) to
> stmmac_adjust_link()
> Since the current stmmac_adjust_link() alreaady have lots of if (has_gmac/gmac4),
> It is now better to create an adjust_link() function for each dwmac.
Is it really, because the diffstat really seems to indicate otherwise
and by looking at the code, I am definitively not convinced this is an
improvement other the current code.
>
> So this patch add an adjust_link() function pointer, and move code out
> of stmmac_adjust_link to it.
Can't we keep the existing adjust_link() function and just have a
different one for dwmac-sun8i that either re-uses portions of the
existing, or duplicate just what it needs?
>
> Removing in the process stmmac_mac_flow_ctrl/stmmac_hw_fix_mac_speed
> since there not used anymore.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/common.h | 3 +
> .../net/ethernet/stmicro/stmmac/dwmac1000_core.c | 54 ++++++++++++++
> .../net/ethernet/stmicro/stmmac/dwmac100_core.c | 46 ++++++++++++
> drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 54 ++++++++++++++
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 83 +---------------------
> 5 files changed, 158 insertions(+), 82 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> index b7ce3fbb5375..451c231006fe 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -469,11 +469,14 @@ struct stmmac_dma_ops {
> };
>
> struct mac_device_info;
> +struct stmmac_priv;
>
> /* Helpers to program the MAC core */
> struct stmmac_ops {
> /* MAC core initialization */
> void (*core_init)(struct mac_device_info *hw, int mtu);
> + /* adjust link */
> + int (*adjust_link)(struct stmmac_priv *priv);
> /* Enable the MAC RX/TX */
> void (*set_mac)(void __iomem *ioaddr, bool enable);
> /* Enable and verify that the IPC module is supported */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
> index f3d9305e5f70..5f3aace46c41 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
> @@ -26,6 +26,7 @@
> #include <linux/slab.h>
> #include <linux/ethtool.h>
> #include <asm/io.h>
> +#include "stmmac.h"
> #include "stmmac_pcs.h"
> #include "dwmac1000.h"
>
> @@ -75,6 +76,58 @@ static void dwmac1000_core_init(struct mac_device_info *hw, int mtu)
> #endif
> }
>
> +static int dwmac1000_adjust_link(struct stmmac_priv *priv)
> +{
> + struct net_device *ndev = priv->dev;
> + struct phy_device *phydev = ndev->phydev;
> + int new_state = 0;
> + u32 tx_cnt = priv->plat->tx_queues_to_use;
> + u32 ctrl;
Reverse christmas tree declaration please.
> +
> + ctrl = readl(priv->ioaddr + GMAC_CONTROL);
> +
> + if (phydev->duplex != priv->oldduplex) {
> + new_state = 1;
bool new_state
> + if (!(phydev->duplex))
Parenthesis not needed (this is an integer, not a bitmask)
> + ctrl &= ~GMAC_CONTROL_DM;
> + else
> + ctrl |= GMAC_CONTROL_DM;
> + priv->oldduplex = phydev->duplex;
> + }
> +
> + if (phydev->pause)
> + priv->hw->mac->flow_ctrl(priv->hw, phydev->duplex, priv->flow_ctrl,
> + priv->pause, tx_cnt);
> +
> + if (phydev->speed != priv->speed) {
> + new_state = 1;
> + switch (phydev->speed) {
> + case 1000:
case SPEED_1000 and so on?
> + ctrl &= ~GMAC_CONTROL_PS;
> + break;
> + case 100:
> + ctrl |= GMAC_CONTROL_PS;
> + ctrl |= GMAC_CONTROL_FES;
> + break;
> + case 10:
> + ctrl |= GMAC_CONTROL_PS;
> + ctrl |= ~GMAC_CONTROL_FES;
> + break;
> + default:
> + netif_warn(priv, link, priv->dev,
> + "broken speed: %d\n", phydev->speed);
> + phydev->speed = SPEED_UNKNOWN;
> + break;
> + }
> + if (phydev->speed != SPEED_UNKNOWN && likely(priv->plat->fix_mac_speed))
> + priv->plat->fix_mac_speed(priv->plat->bsp_priv, phydev->speed);
> + priv->speed = phydev->speed;
> + }
> +
> + writel(ctrl, priv->ioaddr + GMAC_CONTROL);
> + return new_state;
> +}
> +
> static int dwmac1000_rx_ipc_enable(struct mac_device_info *hw)
> {
> void __iomem *ioaddr = hw->pcsr;
> @@ -490,6 +543,7 @@ static void dwmac1000_debug(void __iomem *ioaddr, struct stmmac_extra_stats *x,
>
> static const struct stmmac_ops dwmac1000_ops = {
> .core_init = dwmac1000_core_init,
> + .adjust_link = dwmac1000_adjust_link,
> .set_mac = stmmac_set_mac,
> .rx_ipc = dwmac1000_rx_ipc_enable,
> .dump_regs = dwmac1000_dump_regs,
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
> index 1b3609105484..ba3d46e65e1a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
> @@ -27,6 +27,7 @@
> #include <linux/crc32.h>
> #include <asm/io.h>
> #include "dwmac100.h"
> +#include "stmmac.h"
>
> static void dwmac100_core_init(struct mac_device_info *hw, int mtu)
> {
> @@ -40,6 +41,50 @@ static void dwmac100_core_init(struct mac_device_info *hw, int mtu)
> #endif
> }
>
> +static int dwmac100_adjust_link(struct stmmac_priv *priv)
> +{
> + struct net_device *ndev = priv->dev;
> + struct phy_device *phydev = ndev->phydev;
> + int new_state = 0;
> + u32 tx_cnt = priv->plat->tx_queues_to_use;
> + u32 ctrl;
> +
> + ctrl = readl(priv->ioaddr + MAC_CTRL_REG);
> + if (phydev->duplex != priv->oldduplex) {
> + new_state = 1;
> + if (!(phydev->duplex))
> + ctrl &= ~MAC_CONTROL_F;
> + else
> + ctrl |= MAC_CONTROL_F;
> + priv->oldduplex = phydev->duplex;
> + }
> +
> + if (phydev->pause)
> + priv->hw->mac->flow_ctrl(priv->hw, phydev->duplex, priv->flow_ctrl,
> + priv->pause, tx_cnt);
> +
> + if (phydev->speed != priv->speed) {
> + new_state = 1;
> + switch (phydev->speed) {
> + case 100:
> + case 10:
> + ctrl &= ~MAC_CONTROL_PS;
> + break;
> + default:
> + netif_warn(priv, link, priv->dev,
> + "broken speed: %d\n", phydev->speed);
> + phydev->speed = SPEED_UNKNOWN;
> + break;
> + }
> + if (phydev->speed != SPEED_UNKNOWN && likely(priv->plat->fix_mac_speed))
> + priv->plat->fix_mac_speed(priv->plat->bsp_priv, phydev->speed);
> + priv->speed = phydev->speed;
> + }
> +
> + writel(ctrl, priv->ioaddr + MAC_CTRL_REG);
> + return new_state;
> +}
> +
> static void dwmac100_dump_mac_regs(struct mac_device_info *hw, u32 *reg_space)
> {
> void __iomem *ioaddr = hw->pcsr;
> @@ -150,6 +195,7 @@ static void dwmac100_pmt(struct mac_device_info *hw, unsigned long mode)
>
> static const struct stmmac_ops dwmac100_ops = {
> .core_init = dwmac100_core_init,
> + .adjust_link = dwmac100_adjust_link,
> .set_mac = stmmac_set_mac,
> .rx_ipc = dwmac100_rx_ipc_enable,
> .dump_regs = dwmac100_dump_mac_regs,
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> index 48793f2e9307..133b6bcd7b61 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
> @@ -19,6 +19,7 @@
> #include <linux/io.h>
> #include "stmmac_pcs.h"
> #include "dwmac4.h"
> +#include "stmmac.h"
>
> static void dwmac4_core_init(struct mac_device_info *hw, int mtu)
> {
> @@ -59,6 +60,58 @@ static void dwmac4_core_init(struct mac_device_info *hw, int mtu)
> writel(value, ioaddr + GMAC_INT_EN);
> }
>
> +static int dwmac4_adjust_link(struct stmmac_priv *priv)
> +{
> + struct net_device *ndev = priv->dev;
> + struct phy_device *phydev = ndev->phydev;
> + int new_state = 0;
> + u32 tx_cnt = priv->plat->tx_queues_to_use;
> + u32 ctrl;
> +
> + ctrl = readl(priv->ioaddr + MAC_CTRL_REG);
> +
> + if (phydev->duplex != priv->oldduplex) {
> + new_state = 1;
> + if (!(phydev->duplex))
> + ctrl &= ~GMAC_CONFIG_DM;
> + else
> + ctrl |= GMAC_CONFIG_DM;
> + priv->oldduplex = phydev->duplex;
> + }
> +
> + if (phydev->pause)
> + priv->hw->mac->flow_ctrl(priv->hw, phydev->duplex, priv->flow_ctrl,
> + priv->pause, tx_cnt);
> +
> + if (phydev->speed != priv->speed) {
> + new_state = 1;
> + switch (phydev->speed) {
> + case 1000:
> + ctrl &= ~GMAC_CONFIG_PS;
> + break;
> + case 100:
> + ctrl |= GMAC_CONFIG_PS;
> + ctrl |= GMAC_CONFIG_FES;
> + break;
> + case 10:
> + ctrl |= GMAC_CONFIG_PS;
> + ctrl |= ~GMAC_CONFIG_FES;
> + break;
> + default:
> + netif_warn(priv, link, priv->dev,
> + "broken speed: %d\n", phydev->speed);
> + phydev->speed = SPEED_UNKNOWN;
> + break;
> + }
> + if (phydev->speed != SPEED_UNKNOWN && likely(priv->plat->fix_mac_speed))
> + priv->plat->fix_mac_speed(priv->plat->bsp_priv, phydev->speed);
> + priv->speed = phydev->speed;
> + }
> +
> + writel(ctrl, priv->ioaddr + MAC_CTRL_REG);
> + return new_state;
> +}
> +
> static void dwmac4_rx_queue_enable(struct mac_device_info *hw,
> u8 mode, u32 queue)
> {
> @@ -669,6 +722,7 @@ static void dwmac4_debug(void __iomem *ioaddr, struct stmmac_extra_stats *x,
>
> static const struct stmmac_ops dwmac4_ops = {
> .core_init = dwmac4_core_init,
> + .adjust_link = dwmac4_adjust_link,
> .set_mac = stmmac_set_mac,
> .rx_ipc = dwmac4_rx_ipc_enable,
> .rx_queue_enable = dwmac4_rx_queue_enable,
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index b05a042cf2c6..fb3e2ddaa7c9 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -286,21 +286,6 @@ static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue)
> }
>
> /**
> - * stmmac_hw_fix_mac_speed - callback for speed selection
> - * @priv: driver private structure
> - * Description: on some platforms (e.g. ST), some HW system configuration
> - * registers have to be set according to the link speed negotiated.
> - */
> -static inline void stmmac_hw_fix_mac_speed(struct stmmac_priv *priv)
> -{
> - struct net_device *ndev = priv->dev;
> - struct phy_device *phydev = ndev->phydev;
> -
> - if (likely(priv->plat->fix_mac_speed))
> - priv->plat->fix_mac_speed(priv->plat->bsp_priv, phydev->speed);
> -}
> -
> -/**
> * stmmac_enable_eee_mode - check and enter in LPI mode
> * @priv: driver private structure
> * Description: this function is to verify and enter in LPI mode in case of
> @@ -759,19 +744,6 @@ static void stmmac_release_ptp(struct stmmac_priv *priv)
> }
>
> /**
> - * stmmac_mac_flow_ctrl - Configure flow control in all queues
> - * @priv: driver private structure
> - * Description: It is used for configuring the flow control in all queues
> - */
> -static void stmmac_mac_flow_ctrl(struct stmmac_priv *priv, u32 duplex)
> -{
> - u32 tx_cnt = priv->plat->tx_queues_to_use;
> -
> - priv->hw->mac->flow_ctrl(priv->hw, duplex, priv->flow_ctrl,
> - priv->pause, tx_cnt);
> -}
> -
> -/**
> * stmmac_adjust_link - adjusts the link parameters
> * @dev: net device structure
> * Description: this is the helper called by the physical abstraction layer
> @@ -793,60 +765,7 @@ static void stmmac_adjust_link(struct net_device *dev)
> spin_lock_irqsave(&priv->lock, flags);
>
> if (phydev->link) {
> - u32 ctrl = readl(priv->ioaddr + MAC_CTRL_REG);
> -
> - /* Now we make sure that we can be in full duplex mode.
> - * If not, we operate in half-duplex mode. */
> - if (phydev->duplex != priv->oldduplex) {
> - new_state = 1;
> - if (!(phydev->duplex))
> - ctrl &= ~priv->hw->link.duplex;
> - else
> - ctrl |= priv->hw->link.duplex;
> - priv->oldduplex = phydev->duplex;
> - }
> - /* Flow Control operation */
> - if (phydev->pause)
> - stmmac_mac_flow_ctrl(priv, phydev->duplex);
> -
> - if (phydev->speed != priv->speed) {
> - new_state = 1;
> - switch (phydev->speed) {
> - case 1000:
> - if (priv->plat->has_gmac ||
> - priv->plat->has_gmac4)
> - ctrl &= ~priv->hw->link.port;
> - break;
> - case 100:
> - if (priv->plat->has_gmac ||
> - priv->plat->has_gmac4) {
> - ctrl |= priv->hw->link.port;
> - ctrl |= priv->hw->link.speed;
> - } else {
> - ctrl &= ~priv->hw->link.port;
> - }
> - break;
> - case 10:
> - if (priv->plat->has_gmac ||
> - priv->plat->has_gmac4) {
> - ctrl |= priv->hw->link.port;
> - ctrl &= ~(priv->hw->link.speed);
> - } else {
> - ctrl &= ~priv->hw->link.port;
> - }
> - break;
> - default:
> - netif_warn(priv, link, priv->dev,
> - "broken speed: %d\n", phydev->speed);
> - phydev->speed = SPEED_UNKNOWN;
> - break;
> - }
> - if (phydev->speed != SPEED_UNKNOWN)
> - stmmac_hw_fix_mac_speed(priv);
> - priv->speed = phydev->speed;
> - }
> -
> - writel(ctrl, priv->ioaddr + MAC_CTRL_REG);
> + new_state = priv->hw->mac->adjust_link(priv);
>
> if (!priv->oldlink) {
> new_state = 1;
>
--
Florian
^ permalink raw reply
* Re: [PATCH net] tcp: eliminate negative reordering in tcp_clean_rtx_queue
From: David Miller @ 2017-05-16 16:46 UTC (permalink / raw)
To: soheil.kdev; +Cc: netdev, ilpo.jarvinen, soheil, ncardwell, ycheng, edumazet
In-Reply-To: <20170515210547.125052-1-soheil.kdev@gmail.com>
From: Soheil Hassas Yeganeh <soheil.kdev@gmail.com>
Date: Mon, 15 May 2017 17:05:47 -0400
> From: Soheil Hassas Yeganeh <soheil@google.com>
>
> tcp_ack() can call tcp_fragment() which may dededuct the
> value tp->fackets_out when MSS changes. When prior_fackets
> is larger than tp->fackets_out, tcp_clean_rtx_queue() can
> invoke tcp_update_reordering() with negative values. This
> results in absurd tp->reodering values higher than
> sysctl_tcp_max_reordering.
>
> Note that tcp_update_reordering indeeds sets tp->reordering
> to min(sysctl_tcp_max_reordering, metric), but because
> the comparison is signed, a negative metric always wins.
>
> Fixes: c7caf8d3ed7a ("[TCP]: Fix reord detection due to snd_una covered holes")
> Reported-by: Rebecca Isaacs <risaacs@google.com>
> Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: David Miller @ 2017-05-16 16:49 UTC (permalink / raw)
To: dledford
Cc: Bart.VanAssche, torvalds, hch, netdev, linux-rdma, stable, ubraun
In-Reply-To: <1494952963.3259.109.camel@redhat.com>
From: Doug Ledford <dledford@redhat.com>
Date: Tue, 16 May 2017 12:42:43 -0400
> On Tue, 2017-05-16 at 12:29 -0400, David Miller wrote:
>> From: Doug Ledford <dledford@redhat.com>
>> Date: Tue, 16 May 2017 11:57:04 -0400
>>
>> > Regardless though, I'm rather purturbed about this entire thing.
>> If
>> > you are right that because this got into 4.11, it's now a done
>> deal,
>> > then the fact that this went through 4 review cycles on netdev@
>> that,
>> > as I understand it, spanned roughly one years time, and not one
>> single
>> > person bothered to note that this was as much an RDMA driver as
>> > anything else, and not one person bothered to note that linux-rdma@
>> was
>> > not on the Cc: list, and not one person told the submitters that
>> they
>> > needed to include linux-rdma@ on the Cc: list of these submissions,
>> and
>> > you took it without any review comments from any RDMA people in the
>> > course of a year, or an ack from me to show that the RDMA portion
>> of
>> > this had at least been given some sort of review, was a collosal
>> fuckup
>> > of cross tree maintainer cooperation.
>>
>> We rely on people from various areas of expertiece to contribute to
>> patch review on netdev and give appropriate feedback.
>>
>> If you actually look through the history, I made many semantic
>> reviews
>> of the SMC changes, and kept pushing back.
>>
>> And in fact I did this several times, making them go through several
>> revisions, in the hopes that someone would review more of the meat
>> and
>> substance of the patch set.
>
> If you want to walk to the mailbox, you walk to the mailbox, you don't
> walk to the grocery store, to the gym, and never even go to the
> mailbox. Likewise, if you want review from RDMA experts, most (maybe
> even all) don't subscribe to netdev@ because it's too high traffic, you
> don't waste time on silly semantic pushbacks, you send a single email
> that says "Please get review from linux-rdma@, thank you." Don't beat
> around the bush, be direct and get it over with. That's exactly what I
> do for all netdev@ related patches coming to linux-rdma@ without a
> proper Cc: to netdev@.
Read my other email, it wasn't %100 clear to me that this was so
strictly RDMA related. And I kept pushing back with semantic changes
in part because it wasn't clear.
So as far as I was concerned I was not necessarily going to the wrong
store, in fact I wasn't sure what store to go to.
And none of the thousands of subscribers to netdev intuit'd this
either. Maybe there is a reason for that.
Furthermore, if netdev is too much traffic for one or two RDMA people
to just casually subscribe to on the off chance that a situationm like
this comes up, guess what it is like for me who has to read and review
pretty much every single posting that is placed there?
^ permalink raw reply
* Re: [PATCH] ipmr: vrf: Find VIFs using the actual device
From: David Miller @ 2017-05-16 16:52 UTC (permalink / raw)
To: Thomas.Winter; +Cc: netdev, dsa, nikolay, roopa
In-Reply-To: <20170515221444.4913-1-Thomas.Winter@alliedtelesis.co.nz>
From: Thomas Winter <Thomas.Winter@alliedtelesis.co.nz>
Date: Tue, 16 May 2017 10:14:44 +1200
> The skb->dev that is passed into ip_mr_input is
> the loX device for VRFs. When we lookup a vif
> for this dev, none is found as we do not create
> vifs for loopbacks. Instead lookup a vif for the
> actual device that the packet was received on,
> eg the vlan.
>
> Signed-off-by: Thomas Winter <Thomas.Winter@alliedtelesis.co.nz>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH net-next 0/9] nfp: LSO, checksum and XDP datapath updates
From: David Miller @ 2017-05-16 16:59 UTC (permalink / raw)
To: jakub.kicinski; +Cc: netdev, oss-drivers
In-Reply-To: <20170516005523.26124-1-jakub.kicinski@netronome.com>
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Mon, 15 May 2017 17:55:14 -0700
> This series introduces a number of refinements to standard features
> like LSO and checksum offload. Three major features are support for
> CHECKSUM_COMPLETE, refinement of TSO handling and another small speed
> up for XDP TX. This series also switches from depending on some
> app FW<>driver ABI versions to heavier use of capabilities.
Series applied, thanks Jakub.
^ permalink raw reply
* Re: [PATCH] net/smc: mark as BROKEN due to remote memory exposure
From: Doug Ledford @ 2017-05-16 17:12 UTC (permalink / raw)
To: David Miller
Cc: hch, Bart.VanAssche, torvalds, netdev, linux-rdma, stable, ubraun
In-Reply-To: <20170516.124129.292555623308256441.davem@davemloft.net>
On Tue, 2017-05-16 at 12:41 -0400, David Miller wrote:
> From: Doug Ledford <dledford@redhat.com>
> Date: Tue, 16 May 2017 12:36:01 -0400
>
> > On Tue, 2017-05-16 at 18:30 +0200, Christoph Hellwig wrote:
> >> On Tue, May 16, 2017 at 12:29:23PM -0400, David Miller wrote:
> >> >
> >> > I can't push back on people with silly coding style and small
> >> > semantic
> >> > issues forever. And I think I made a serious effort to keep the
> >> > patches getting posted over and over again to make sure they got
> >> > more
> >> > exposure.
> >>
> >> You can tell them to go to linux-rdma. I'm sending people to the
> >> right
> >> mailing list all the time.
> >
> > Indeed. Every single time a patch comes into linux-rdma that
> touches
> > things in net/ or include/net, unless it is exceedingly minor, I
> check
> > the To:/Cc: lines on the email and if netdev@ isn't included, or in
> the
> > case of complex/tricky items, you aren't directly Cc:ed, then I
> > specifically tell them to include netdev@ and/or you. I've even
> had
> > things like a 12 patch series that buried three netdev@ appropriate
> > patches at different points in the series and told the submitter to
> > move all of the netdev@ related patches to the front and submit
> them to
> > netdev@ so they can be reviewed as a group before I would move on
> to
> > the others. It's just what you do. I've always considered that
> part
> > of my job.
>
> To be quite honest it wasn't exceedingly clear, even to me, that this
> had such implications or was directly a RDMA thing. From my
> perspective while reviewing I saw a patch series adding it's own
> protocol stack living inside of it's own directory under net/
OK. Fair enough. That implies to me that you probably dove right into
the patches and skimmed the cover letter (http://marc.info/?l=linux-s39
0&m=148397751211964&w=2), because when I read the cover letter, it
seems pretty clear to me that this is very much RDMA related. In any
case, there are already two other code bases that live under net/ but
also involve RDMA heavily: nfs and rds. This is a third now. So, for
future reference, just like the RDMA related nfs/rds patches already
get Cc:ed to linux-rdma@, these probably should be too.
> And, if even one RDMA/infiniband person said to me "you really
> shouldn't apply this" then I would have dropped it on the spot.
I'm glad to hear that. I wish we had managed to get together on this
sooner.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: B826A3330E572FDD
Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox