* [RFC PATCH 1/2] mac80211: aes_ccm: prepare key struct for storing context data
From: Ard Biesheuvel @ 2016-10-18 14:08 UTC (permalink / raw)
To: linux-wireless, johannes, netdev; +Cc: herbert, j, luto, Ard Biesheuvel
In-Reply-To: <1476799713-16188-1-git-send-email-ard.biesheuvel@linaro.org>
As a prepatory change to allow per CPU caching of request structures,
refactor the key allocation routine so we can access per key data
beyond the core AEAD transform easily.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
net/mac80211/aes_ccm.c | 35 +++++++++++---------
net/mac80211/aes_ccm.h | 16 ++++-----
net/mac80211/key.c | 16 ++++-----
net/mac80211/key.h | 2 +-
net/mac80211/wpa.c | 4 +--
5 files changed, 37 insertions(+), 36 deletions(-)
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c
index a4e0d59a40dd..58e0338a2c34 100644
--- a/net/mac80211/aes_ccm.c
+++ b/net/mac80211/aes_ccm.c
@@ -10,6 +10,7 @@
*/
#include <linux/kernel.h>
+#include <linux/percpu.h>
#include <linux/types.h>
#include <linux/err.h>
#include <crypto/aead.h>
@@ -18,13 +19,13 @@
#include "key.h"
#include "aes_ccm.h"
-int ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic,
+int ieee80211_aes_ccm_encrypt(struct ieee80211_ccmp_aead *ccmp, u8 *b_0,
+ u8 *aad, u8 *data, size_t data_len, u8 *mic,
size_t mic_len)
{
struct scatterlist sg[3];
struct aead_request *aead_req;
- int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm);
+ int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(ccmp->tfm);
u8 *__aad;
aead_req = kzalloc(reqsize + CCM_AAD_LEN, GFP_ATOMIC);
@@ -39,7 +40,7 @@ int ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
sg_set_buf(&sg[1], data, data_len);
sg_set_buf(&sg[2], mic, mic_len);
- aead_request_set_tfm(aead_req, tfm);
+ aead_request_set_tfm(aead_req, ccmp->tfm);
aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
aead_request_set_ad(aead_req, sg[0].length);
@@ -49,13 +50,13 @@ int ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
return 0;
}
-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic,
+int ieee80211_aes_ccm_decrypt(struct ieee80211_ccmp_aead *ccmp, u8 *b_0,
+ u8 *aad, u8 *data, size_t data_len, u8 *mic,
size_t mic_len)
{
struct scatterlist sg[3];
struct aead_request *aead_req;
- int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm);
+ int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(ccmp->tfm);
u8 *__aad;
int err;
@@ -74,7 +75,7 @@ int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
sg_set_buf(&sg[1], data, data_len);
sg_set_buf(&sg[2], mic, mic_len);
- aead_request_set_tfm(aead_req, tfm);
+ aead_request_set_tfm(aead_req, ccmp->tfm);
aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
aead_request_set_ad(aead_req, sg[0].length);
@@ -84,16 +85,17 @@ int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
return err;
}
-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
- size_t key_len,
- size_t mic_len)
+int ieee80211_aes_key_setup_encrypt(struct ieee80211_ccmp_aead *ccmp,
+ const u8 key[],
+ size_t key_len,
+ size_t mic_len)
{
struct crypto_aead *tfm;
int err;
tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm))
- return tfm;
+ return PTR_ERR(tfm);
err = crypto_aead_setkey(tfm, key, key_len);
if (err)
@@ -102,14 +104,15 @@ struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
if (err)
goto free_aead;
- return tfm;
+ ccmp->tfm = tfm;
+ return 0;
free_aead:
crypto_free_aead(tfm);
- return ERR_PTR(err);
+ return err;
}
-void ieee80211_aes_key_free(struct crypto_aead *tfm)
+void ieee80211_aes_key_free(struct ieee80211_ccmp_aead *ccmp)
{
- crypto_free_aead(tfm);
+ crypto_free_aead(ccmp->tfm);
}
diff --git a/net/mac80211/aes_ccm.h b/net/mac80211/aes_ccm.h
index fcd3254c5cf0..82e91c6ec41f 100644
--- a/net/mac80211/aes_ccm.h
+++ b/net/mac80211/aes_ccm.h
@@ -14,15 +14,15 @@
#define CCM_AAD_LEN 32
-struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
- size_t key_len,
- size_t mic_len);
-int ieee80211_aes_ccm_encrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic,
+int ieee80211_aes_key_setup_encrypt(struct ieee80211_ccmp_aead *ccmp,
+ const u8 key[], size_t key_len,
+ size_t mic_len);
+int ieee80211_aes_ccm_encrypt(struct ieee80211_ccmp_aead *ccmp, u8 *b_0,
+ u8 *aad, u8 *data, size_t data_len, u8 *mic,
size_t mic_len);
-int ieee80211_aes_ccm_decrypt(struct crypto_aead *tfm, u8 *b_0, u8 *aad,
- u8 *data, size_t data_len, u8 *mic,
+int ieee80211_aes_ccm_decrypt(struct ieee80211_ccmp_aead *ccmp, u8 *b_0,
+ u8 *aad, u8 *data, size_t data_len, u8 *mic,
size_t mic_len);
-void ieee80211_aes_key_free(struct crypto_aead *tfm);
+void ieee80211_aes_key_free(struct ieee80211_ccmp_aead *ccmp);
#endif /* AES_CCM_H */
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index edd6f2945f69..6d1a066e3c4e 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -431,10 +431,9 @@ ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
* Initialize AES key state here as an optimization so that
* it does not need to be initialized for every packet.
*/
- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
- key_data, key_len, IEEE80211_CCMP_MIC_LEN);
- if (IS_ERR(key->u.ccmp.tfm)) {
- err = PTR_ERR(key->u.ccmp.tfm);
+ err = ieee80211_aes_key_setup_encrypt(&key->u.ccmp, key_data,
+ key_len, IEEE80211_CCMP_MIC_LEN);
+ if (err) {
kfree(key);
return ERR_PTR(err);
}
@@ -449,10 +448,9 @@ ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
/* Initialize AES key state here as an optimization so that
* it does not need to be initialized for every packet.
*/
- key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(
- key_data, key_len, IEEE80211_CCMP_256_MIC_LEN);
- if (IS_ERR(key->u.ccmp.tfm)) {
- err = PTR_ERR(key->u.ccmp.tfm);
+ err = ieee80211_aes_key_setup_encrypt(&key->u.ccmp, key_data,
+ key_len, IEEE80211_CCMP_256_MIC_LEN);
+ if (err) {
kfree(key);
return ERR_PTR(err);
}
@@ -545,7 +543,7 @@ static void ieee80211_key_free_common(struct ieee80211_key *key)
switch (key->conf.cipher) {
case WLAN_CIPHER_SUITE_CCMP:
case WLAN_CIPHER_SUITE_CCMP_256:
- ieee80211_aes_key_free(key->u.ccmp.tfm);
+ ieee80211_aes_key_free(&key->u.ccmp);
break;
case WLAN_CIPHER_SUITE_AES_CMAC:
case WLAN_CIPHER_SUITE_BIP_CMAC_256:
diff --git a/net/mac80211/key.h b/net/mac80211/key.h
index 4aa20cef0859..1ec7a737ab79 100644
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
@@ -80,7 +80,7 @@ struct ieee80211_key {
/* number of mic failures */
u32 mic_failures;
} tkip;
- struct {
+ struct ieee80211_ccmp_aead {
/*
* Last received packet number. The first
* IEEE80211_NUM_TIDS counters are used with Data
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index 14b28998c571..694af013494f 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -461,7 +461,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb,
pos += IEEE80211_CCMP_HDR_LEN;
ccmp_special_blocks(skb, pn, b_0, aad);
- return ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, b_0, aad, pos, len,
+ return ieee80211_aes_ccm_encrypt(&key->u.ccmp, b_0, aad, pos, len,
skb_put(skb, mic_len), mic_len);
}
@@ -538,7 +538,7 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
ccmp_special_blocks(skb, pn, b_0, aad);
if (ieee80211_aes_ccm_decrypt(
- key->u.ccmp.tfm, b_0, aad,
+ &key->u.ccmp, b_0, aad,
skb->data + hdrlen + IEEE80211_CCMP_HDR_LEN,
data_len,
skb->data + skb->len - mic_len, mic_len))
--
2.7.4
^ permalink raw reply related
* [RFC PATCH 2/2] mac80211: aes_ccm: cache AEAD request structures per CPU
From: Ard Biesheuvel @ 2016-10-18 14:08 UTC (permalink / raw)
To: linux-wireless, johannes, netdev; +Cc: herbert, j, luto, Ard Biesheuvel
In-Reply-To: <1476799713-16188-1-git-send-email-ard.biesheuvel@linaro.org>
Now that we can no longer invoke AEAD transforms with the aead_request
structure allocated on the stack, we perform a kmalloc/kfree for every
packet, which is expensive.
Since the CCMP routines execute in softirq context, we know there can
never be more than one request in flight on each CPU, and so we can
simply keep a cached aead_request structure per CPU, and deallocate all
of them when deallocating the AEAD transform.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
net/mac80211/aes_ccm.c | 49 ++++++++++++++------
net/mac80211/key.h | 1 +
2 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/net/mac80211/aes_ccm.c b/net/mac80211/aes_ccm.c
index 58e0338a2c34..2cb5ee4868ea 100644
--- a/net/mac80211/aes_ccm.c
+++ b/net/mac80211/aes_ccm.c
@@ -28,9 +28,14 @@ int ieee80211_aes_ccm_encrypt(struct ieee80211_ccmp_aead *ccmp, u8 *b_0,
int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(ccmp->tfm);
u8 *__aad;
- aead_req = kzalloc(reqsize + CCM_AAD_LEN, GFP_ATOMIC);
- if (!aead_req)
- return -ENOMEM;
+ aead_req = *this_cpu_ptr(ccmp->reqs);
+ if (!aead_req) {
+ aead_req = kzalloc(reqsize + CCM_AAD_LEN, GFP_ATOMIC);
+ if (!aead_req)
+ return -ENOMEM;
+ *this_cpu_ptr(ccmp->reqs) = aead_req;
+ aead_request_set_tfm(aead_req, ccmp->tfm);
+ }
__aad = (u8 *)aead_req + reqsize;
memcpy(__aad, aad, CCM_AAD_LEN);
@@ -40,12 +45,10 @@ int ieee80211_aes_ccm_encrypt(struct ieee80211_ccmp_aead *ccmp, u8 *b_0,
sg_set_buf(&sg[1], data, data_len);
sg_set_buf(&sg[2], mic, mic_len);
- aead_request_set_tfm(aead_req, ccmp->tfm);
aead_request_set_crypt(aead_req, sg, sg, data_len, b_0);
aead_request_set_ad(aead_req, sg[0].length);
crypto_aead_encrypt(aead_req);
- kzfree(aead_req);
return 0;
}
@@ -58,14 +61,18 @@ int ieee80211_aes_ccm_decrypt(struct ieee80211_ccmp_aead *ccmp, u8 *b_0,
struct aead_request *aead_req;
int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(ccmp->tfm);
u8 *__aad;
- int err;
if (data_len == 0)
return -EINVAL;
- aead_req = kzalloc(reqsize + CCM_AAD_LEN, GFP_ATOMIC);
- if (!aead_req)
- return -ENOMEM;
+ aead_req = *this_cpu_ptr(ccmp->reqs);
+ if (!aead_req) {
+ aead_req = kzalloc(reqsize + CCM_AAD_LEN, GFP_ATOMIC);
+ if (!aead_req)
+ return -ENOMEM;
+ *this_cpu_ptr(ccmp->reqs) = aead_req;
+ aead_request_set_tfm(aead_req, ccmp->tfm);
+ }
__aad = (u8 *)aead_req + reqsize;
memcpy(__aad, aad, CCM_AAD_LEN);
@@ -75,14 +82,10 @@ int ieee80211_aes_ccm_decrypt(struct ieee80211_ccmp_aead *ccmp, u8 *b_0,
sg_set_buf(&sg[1], data, data_len);
sg_set_buf(&sg[2], mic, mic_len);
- aead_request_set_tfm(aead_req, ccmp->tfm);
aead_request_set_crypt(aead_req, sg, sg, data_len + mic_len, b_0);
aead_request_set_ad(aead_req, sg[0].length);
- err = crypto_aead_decrypt(aead_req);
- kzfree(aead_req);
-
- return err;
+ return crypto_aead_decrypt(aead_req);
}
int ieee80211_aes_key_setup_encrypt(struct ieee80211_ccmp_aead *ccmp,
@@ -91,6 +94,7 @@ int ieee80211_aes_key_setup_encrypt(struct ieee80211_ccmp_aead *ccmp,
size_t mic_len)
{
struct crypto_aead *tfm;
+ struct aead_request **r;
int err;
tfm = crypto_alloc_aead("ccm(aes)", 0, CRYPTO_ALG_ASYNC);
@@ -104,6 +108,14 @@ int ieee80211_aes_key_setup_encrypt(struct ieee80211_ccmp_aead *ccmp,
if (err)
goto free_aead;
+ /* allow a struct aead_request to be cached per cpu */
+ r = alloc_percpu(struct aead_request *);
+ if (!r) {
+ err = -ENOMEM;
+ goto free_aead;
+ }
+
+ ccmp->reqs = r;
ccmp->tfm = tfm;
return 0;
@@ -114,5 +126,14 @@ int ieee80211_aes_key_setup_encrypt(struct ieee80211_ccmp_aead *ccmp,
void ieee80211_aes_key_free(struct ieee80211_ccmp_aead *ccmp)
{
+ struct aead_request *req;
+ int cpu;
+
+ for_each_possible_cpu(cpu) {
+ req = *per_cpu_ptr(ccmp->reqs, cpu);
+ if (req)
+ kzfree(req);
+ }
+ free_percpu(ccmp->reqs);
crypto_free_aead(ccmp->tfm);
}
diff --git a/net/mac80211/key.h b/net/mac80211/key.h
index 1ec7a737ab79..f99ec46dc08f 100644
--- a/net/mac80211/key.h
+++ b/net/mac80211/key.h
@@ -89,6 +89,7 @@ struct ieee80211_key {
*/
u8 rx_pn[IEEE80211_NUM_TIDS + 1][IEEE80211_CCMP_PN_LEN];
struct crypto_aead *tfm;
+ struct aead_request * __percpu *reqs;
u32 replays; /* dot11RSNAStatsCCMPReplays */
} ccmp;
struct {
--
2.7.4
^ permalink raw reply related
* [RFC PATCH 0/2] mac80211: aes_ccm: cache AEAD request allocations per CPU
From: Ard Biesheuvel @ 2016-10-18 14:08 UTC (permalink / raw)
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
johannes-cdvu00un1VgdHxzADdlk8Q, netdev-u79uwXL29TY76Z2rM5mHXA
Cc: herbert-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q, j,
luto-kltTT9wpgjJwATOyAt5JVQ, Ard Biesheuvel
This RFC implements per CPU caching of AEAD request structures, which allows
us to get rid of the per-packet kzalloc/kzfree calls we were forced to
introduce to deal with SG API violations, both in the mac80211 and in the
core crypto API code.
Since mac80211 only executes the AEAD transforms in softirq context, only one
AEAD request can be in flight at the same time on any given CPU, and so, instead
of free the request, we can stash its address in a per CPU variable, and reuse
it for the next packet.
This RFC only addressess CCMP, but GCM and GMAC could be fixed in the same way
(and CMAC did not suffer from the API violation issue in the first place)
Ard Biesheuvel (2):
mac80211: aes_ccm: prepare key struct for storing context data
mac80211: aes_ccm: cache AEAD request structures per CPU
net/mac80211/aes_ccm.c | 80 +++++++++++++-------
net/mac80211/aes_ccm.h | 16 ++--
net/mac80211/key.c | 16 ++--
net/mac80211/key.h | 3 +-
net/mac80211/wpa.c | 4 +-
5 files changed, 71 insertions(+), 48 deletions(-)
--
2.7.4
^ permalink raw reply
* Re: [PATCH net v2] flow_dissector: Check skb for VLAN only if skb specified.
From: Or Gerlitz @ 2016-10-18 13:59 UTC (permalink / raw)
To: Eric Garver, David Miller; +Cc: Linux Netdev List, Hadar Hen Zion
In-Reply-To: <1476736212-21238-1-git-send-email-e@erig.me>
On Mon, Oct 17, 2016 at 11:30 PM, Eric Garver <e@erig.me> wrote:
> Fixes a panic when calling eth_get_headlen(). Noticed on i40e driver.
>
> Fixes: d5709f7ab776 ("flow_dissector: For stripped vlan, get vlan info from skb->vlan_tci")
> Signed-off-by: Eric Garver <e@erig.me>
Dave,
Hadar is OOO and I have asked Amir to look on the fix, will appreciate
if we can have 24 hours to respond
Or.
^ permalink raw reply
* Re: [PATCH 04/10] mm: replace get_user_pages_locked() write/force parameters with gup_flags
From: Lorenzo Stoakes @ 2016-10-18 13:56 UTC (permalink / raw)
To: Jan Kara
Cc: linux-mm, Linus Torvalds, Hugh Dickins, Dave Hansen, Rik van Riel,
Mel Gorman, Andrew Morton, adi-buildroot-devel, ceph-devel,
dri-devel, intel-gfx, kvm, linux-alpha, linux-arm-kernel,
linux-cris-kernel, linux-fbdev, linux-fsdevel, linux-ia64,
linux-kernel, linux-media, linux-mips, linux-rdma, linux-s390,
linux-samsung-soc
In-Reply-To: <20161018125425.GD29967@quack2.suse.cz>
On Tue, Oct 18, 2016 at 02:54:25PM +0200, Jan Kara wrote:
> > @@ -1282,7 +1282,7 @@ long get_user_pages(unsigned long start, unsigned long nr_pages,
> > int write, int force, struct page **pages,
> > struct vm_area_struct **vmas);
> > long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
> > - int write, int force, struct page **pages, int *locked);
> > + unsigned int gup_flags, struct page **pages, int *locked);
>
> Hum, the prototype is inconsistent with e.g. __get_user_pages_unlocked()
> where gup_flags come after **pages argument. Actually it makes more sense
> to have it before **pages so that input arguments come first and output
> arguments second but I don't care that much. But it definitely should be
> consistent...
It was difficult to decide quite how to arrange parameters as there was
inconsitency with regards to parameter ordering already - for example
__get_user_pages() places its flags argument before pages whereas, as you note,
__get_user_pages_unlocked() puts them afterwards.
I ended up compromising by trying to match the existing ordering of the function
as much as I could by replacing write, force pairs with gup_flags in the same
location (with the exception of get_user_pages_unlocked() which I felt should
match __get_user_pages_unlocked() in signature) or if there was already a
gup_flags parameter as in the case of __get_user_pages_unlocked() I simply
removed the write, force pair and left the flags as the last parameter.
I am happy to rearrange parameters as needed, however I am not sure if it'd be
worthwhile for me to do so (I am keen to try to avoid adding too much noise here
:)
If we were to rearrange parameters for consistency I'd suggest adjusting
__get_user_pages_unlocked() to put gup_flags before pages and do the same with
get_user_pages_unlocked(), let me know what you think.
^ permalink raw reply
* Re: [PATCH net-next 09/15] ethernet/dlink: use core min/max MTU checking
From: Denis Kirjanov @ 2016-10-18 13:45 UTC (permalink / raw)
To: Jarod Wilson; +Cc: linux-kernel, netdev
In-Reply-To: <20161017195417.48259-10-jarod@redhat.com>
On 10/17/16, Jarod Wilson <jarod@redhat.com> wrote:
> dl2k: min_mtu 68, max_mtu 1536 or 8000, depending on hardware
> - Removed change_mtu, does nothing productive anymore
>
> sundance: min_mtu 68, max_mtu 8191
>
> CC: netdev@vger.kernel.org
> CC: Denis Kirjanov <kda@linux-powerpc.org>
> Signed-off-by: Jarod Wilson <jarod@redhat.com>
> ---
> drivers/net/ethernet/dlink/dl2k.c | 22 ++++------------------
> drivers/net/ethernet/dlink/sundance.c | 6 ++++--
> 2 files changed, 8 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/net/ethernet/dlink/dl2k.c
> b/drivers/net/ethernet/dlink/dl2k.c
> index 78f1446..8c95a8a 100644
> --- a/drivers/net/ethernet/dlink/dl2k.c
> +++ b/drivers/net/ethernet/dlink/dl2k.c
> @@ -76,7 +76,6 @@ static void rio_free_tx (struct net_device *dev, int
> irq);
> static void tx_error (struct net_device *dev, int tx_status);
> static int receive_packet (struct net_device *dev);
> static void rio_error (struct net_device *dev, int int_status);
> -static int change_mtu (struct net_device *dev, int new_mtu);
> static void set_multicast (struct net_device *dev);
> static struct net_device_stats *get_stats (struct net_device *dev);
> static int clear_stats (struct net_device *dev);
> @@ -106,7 +105,6 @@ static const struct net_device_ops netdev_ops = {
> .ndo_set_rx_mode = set_multicast,
> .ndo_do_ioctl = rio_ioctl,
> .ndo_tx_timeout = rio_tx_timeout,
> - .ndo_change_mtu = change_mtu,
> };
>
> static int
> @@ -230,6 +228,10 @@ rio_probe1 (struct pci_dev *pdev, const struct
> pci_device_id *ent)
> #if 0
> dev->features = NETIF_F_IP_CSUM;
> #endif
> + /* MTU range: 68 - 1536 or 8000 */
> + dev->min_mtu = ETH_MIN_MTU;
> + dev->max_mtu = np->jumbo ? MAX_JUMBO : PACKET_SIZE;
> +
> pci_set_drvdata (pdev, dev);
>
> ring_space = pci_alloc_consistent (pdev, TX_TOTAL_SIZE, &ring_dma);
> @@ -1198,22 +1200,6 @@ clear_stats (struct net_device *dev)
> return 0;
> }
>
> -
> -static int
> -change_mtu (struct net_device *dev, int new_mtu)
> -{
> - struct netdev_private *np = netdev_priv(dev);
> - int max = (np->jumbo) ? MAX_JUMBO : 1536;
> -
> - if ((new_mtu < 68) || (new_mtu > max)) {
> - return -EINVAL;
> - }
> -
> - dev->mtu = new_mtu;
> -
> - return 0;
> -}
> -
> static void
> set_multicast (struct net_device *dev)
> {
> diff --git a/drivers/net/ethernet/dlink/sundance.c
> b/drivers/net/ethernet/dlink/sundance.c
> index 79d8009..eab36ac 100644
> --- a/drivers/net/ethernet/dlink/sundance.c
> +++ b/drivers/net/ethernet/dlink/sundance.c
> @@ -580,6 +580,10 @@ static int sundance_probe1(struct pci_dev *pdev,
> dev->ethtool_ops = ðtool_ops;
> dev->watchdog_timeo = TX_TIMEOUT;
>
> + /* MTU range: 68 - 8191 */
> + dev->min_mtu = ETH_MIN_MTU;
> + dev->max_mtu = 8191;
> +
ICPlus datasheet defines the max frame size like 0x1514 or 0x4491
based on the RcvLargeFrames bit in the MACCtrl0 register
> pci_set_drvdata(pdev, dev);
>
> i = register_netdev(dev);
> @@ -713,8 +717,6 @@ static int sundance_probe1(struct pci_dev *pdev,
>
> static int change_mtu(struct net_device *dev, int new_mtu)
> {
> - if ((new_mtu < 68) || (new_mtu > 8191)) /* Set by RxDMAFrameLen */
> - return -EINVAL;
> if (netif_running(dev))
> return -EBUSY;
> dev->mtu = new_mtu;
> --
> 2.10.0
>
>
^ permalink raw reply
* Re: [PATCH] net: dsa: properly disconnect the slave PHYs
From: John Crispin @ 2016-10-18 13:27 UTC (permalink / raw)
To: Andrew Lunn
Cc: Vivien Didelot, Florian Fainelli, David S. Miller, netdev,
linux-kernel
In-Reply-To: <20161018132413.GU26778@lunn.ch>
On 18/10/2016 15:24, Andrew Lunn wrote:
>> Hi Andrew
>>
>> i am testing on v4.4 which did not have a phy_disconnect() call. this
>> seems to have been fixed by cda5c15b so please ignore this patch
>
> Hi John
>
> All patches must be against net-next, or net if it is a fix. Anything
> else is wrong....
>
> Andrew
>
Hi Andrew,
i know. i was testing on v4.4 and then rebased the patch against
net-next without noticing that a similar patch had already been merged.
regardless, using the latest net-next tree, the oops is gone without
adding any patches.
John
^ permalink raw reply
* Re: [PATCH] net: dsa: properly disconnect the slave PHYs
From: Andrew Lunn @ 2016-10-18 13:24 UTC (permalink / raw)
To: John Crispin
Cc: Vivien Didelot, Florian Fainelli, David S. Miller, netdev,
linux-kernel
In-Reply-To: <a310cfb9-8000-3906-242e-501900d5c8a0@phrozen.org>
> Hi Andrew
>
> i am testing on v4.4 which did not have a phy_disconnect() call. this
> seems to have been fixed by cda5c15b so please ignore this patch
Hi John
All patches must be against net-next, or net if it is a fix. Anything
else is wrong....
Andrew
^ permalink raw reply
* [PATCH net] bridge: multicast: restore perm router ports on multicast enable
From: Nikolay Aleksandrov @ 2016-10-18 13:10 UTC (permalink / raw)
To: netdev; +Cc: herbert, roopa, stephen, Nikolay Aleksandrov
Satish reported a problem with the perm multicast router ports not getting
reenabled after some series of events, in particular if it happens that the
multicast snooping has been disabled and the port goes to disabled state
then it will be deleted from the router port list, but if it moves into
non-disabled state it will not be re-added because the mcast snooping is
still disabled, and enabling snooping later does nothing.
Here are the steps to reproduce, setup br0 with snooping enabled and eth1
added as a perm router (multicast_router = 2):
1. $ echo 0 > /sys/class/net/br0/bridge/multicast_snooping
2. $ ip l set eth1 down
^ This step deletes the interface from the router list
3. $ ip l set eth1 up
^ This step does not add it again because mcast snooping is disabled
4. $ echo 1 > /sys/class/net/br0/bridge/multicast_snooping
5. $ bridge -d -s mdb show
<empty>
At this point we have mcast enabled and eth1 as a perm router (value = 2)
but it is not in the router list which is incorrect.
After this change:
1. $ echo 0 > /sys/class/net/br0/bridge/multicast_snooping
2. $ ip l set eth1 down
^ This step deletes the interface from the router list
3. $ ip l set eth1 up
^ This step does not add it again because mcast snooping is disabled
4. $ echo 1 > /sys/class/net/br0/bridge/multicast_snooping
5. $ bridge -d -s mdb show
router ports on br0: eth1
Fixes: 561f1103a2b7 ("bridge: Add multicast_snooping sysfs toggle")
Reported-by: Satish Ashok <sashok@cumulusnetworks.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
net/bridge/br_multicast.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index c5fea9393946..1bc807f1d633 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1992,10 +1992,25 @@ static void br_multicast_start_querier(struct net_bridge *br,
}
}
+static void br_multicast_start_router(struct net_bridge *br)
+{
+ struct net_bridge_port *port;
+
+ list_for_each_entry(port, &br->port_list, list) {
+ if (port->state == BR_STATE_DISABLED ||
+ port->state == BR_STATE_BLOCKING)
+ continue;
+
+ if (port->multicast_router == MDB_RTR_TYPE_PERM &&
+ hlist_unhashed(&port->rlist))
+ br_multicast_add_router(br, port);
+ }
+}
+
int br_multicast_toggle(struct net_bridge *br, unsigned long val)
{
- int err = 0;
struct net_bridge_mdb_htable *mdb;
+ int err = 0;
spin_lock_bh(&br->multicast_lock);
if (br->multicast_disabled == !val)
@@ -2027,6 +2042,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val)
#if IS_ENABLED(CONFIG_IPV6)
br_multicast_start_querier(br, &br->ip6_own_query);
#endif
+ br_multicast_start_router(br);
unlock:
spin_unlock_bh(&br->multicast_lock);
--
2.1.4
^ permalink raw reply related
* Re: [PATCH] net: dsa: properly disconnect the slave PHYs
From: John Crispin @ 2016-10-18 12:54 UTC (permalink / raw)
To: Andrew Lunn
Cc: Vivien Didelot, Florian Fainelli, David S. Miller, netdev,
linux-kernel
In-Reply-To: <20161018122909.GR26778@lunn.ch>
On 18/10/2016 14:29, Andrew Lunn wrote:
> On Tue, Oct 18, 2016 at 02:12:40PM +0200, John Crispin wrote:
>> The shutdown code only stopped the PHYs but does not diconnect them
>> properly. This could lead to null pointer deref related kernel oopses
>> during reboot. Fix this by calling phy_disconnect() after the PHYs are
>> stopped.
>
> Humm, i don't follow this.
>
> The phy is disconnected in dsa_slave_destroy(). Why is that not
> sufficient?
>
> Also, after calling dsa_slave_close(), dsa_slave_open() can be
> called. But with your change, the phy has gone, so we are going to
> have trouble.
>
> Andrew
>
Hi Andrew
i am testing on v4.4 which did not have a phy_disconnect() call. this
seems to have been fixed by cda5c15b so please ignore this patch
John
>>
>> Signed-off-by: John Crispin <john@phrozen.org>
>> ---
>> net/dsa/slave.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
>> index 68714a5..725d9f7 100644
>> --- a/net/dsa/slave.c
>> +++ b/net/dsa/slave.c
>> @@ -154,8 +154,10 @@ static int dsa_slave_close(struct net_device *dev)
>> struct net_device *master = p->parent->dst->master_netdev;
>> struct dsa_switch *ds = p->parent;
>>
>> - if (p->phy)
>> + if (p->phy) {
>> phy_stop(p->phy);
>> + phy_disconnect(p->phy);
>> + }
>>
>> dev_mc_unsync(master, dev);
>> dev_uc_unsync(master, dev);
>> --
>> 1.7.10.4
>>
^ permalink raw reply
* Re: [PATCH 04/10] mm: replace get_user_pages_locked() write/force parameters with gup_flags
From: Jan Kara @ 2016-10-18 12:54 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: linux-mips, linux-fbdev, Jan Kara, kvm, linux-sh, Dave Hansen,
dri-devel, linux-mm, netdev, sparclinux, linux-ia64, linux-s390,
linux-samsung-soc, linux-scsi, linux-rdma, x86, Hugh Dickins,
linux-media, Rik van Riel, intel-gfx, adi-buildroot-devel,
ceph-devel, linux-arm-kernel, linux-cris-kernel, Linus Torvalds,
linuxppc-dev, linux-kernel, linux-security-module, linux-alpha,
lin
In-Reply-To: <20161013002020.3062-5-lstoakes@gmail.com>
On Thu 13-10-16 01:20:14, Lorenzo Stoakes wrote:
> This patch removes the write and force parameters from get_user_pages_locked()
> and replaces them with a gup_flags parameter to make the use of FOLL_FORCE
> explicit in callers as use of this flag can result in surprising behaviour (and
> hence bugs) within the mm subsystem.
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
> ---
> include/linux/mm.h | 2 +-
> mm/frame_vector.c | 8 +++++++-
> mm/gup.c | 12 +++---------
> mm/nommu.c | 5 ++++-
> 4 files changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 6adc4bc..27ab538 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1282,7 +1282,7 @@ long get_user_pages(unsigned long start, unsigned long nr_pages,
> int write, int force, struct page **pages,
> struct vm_area_struct **vmas);
> long get_user_pages_locked(unsigned long start, unsigned long nr_pages,
> - int write, int force, struct page **pages, int *locked);
> + unsigned int gup_flags, struct page **pages, int *locked);
Hum, the prototype is inconsistent with e.g. __get_user_pages_unlocked()
where gup_flags come after **pages argument. Actually it makes more sense
to have it before **pages so that input arguments come first and output
arguments second but I don't care that much. But it definitely should be
consistent...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply
* Re: [PATCH 03/10] mm: replace get_user_pages_unlocked() write/force parameters with gup_flags
From: Jan Kara @ 2016-10-18 12:50 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: linux-mips, linux-fbdev, Jan Kara, kvm, linux-sh, Dave Hansen,
dri-devel, linux-mm, netdev, sparclinux, linux-ia64, linux-s390,
linux-samsung-soc, linux-scsi, linux-rdma, x86, Hugh Dickins,
linux-media, Rik van Riel, intel-gfx, adi-buildroot-devel,
ceph-devel, linux-arm-kernel, linux-cris-kernel, Linus Torvalds,
linuxppc-dev, linux-kernel, linux-security-module, linux-alpha,
lin
In-Reply-To: <20161013002020.3062-4-lstoakes@gmail.com>
On Thu 13-10-16 01:20:13, Lorenzo Stoakes wrote:
> This patch removes the write and force parameters from get_user_pages_unlocked()
> and replaces them with a gup_flags parameter to make the use of FOLL_FORCE
> explicit in callers as use of this flag can result in surprising behaviour (and
> hence bugs) within the mm subsystem.
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply
* Re: [PATCH 02/10] mm: remove write/force parameters from __get_user_pages_unlocked()
From: Jan Kara @ 2016-10-18 12:46 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: linux-mips, linux-fbdev, Jan Kara, kvm, linux-sh, Dave Hansen,
dri-devel, linux-mm, netdev, sparclinux, linux-ia64, linux-s390,
linux-samsung-soc, linux-scsi, linux-rdma, x86, Hugh Dickins,
linux-media, Rik van Riel, intel-gfx, adi-buildroot-devel,
ceph-devel, linux-arm-kernel, linux-cris-kernel, Linus Torvalds,
linuxppc-dev, linux-kernel, linux-security-module, linux-alpha,
lin
In-Reply-To: <20161013002020.3062-3-lstoakes@gmail.com>
On Thu 13-10-16 01:20:12, Lorenzo Stoakes wrote:
> This patch removes the write and force parameters from
> __get_user_pages_unlocked() to make the use of FOLL_FORCE explicit in callers as
> use of this flag can result in surprising behaviour (and hence bugs) within the
> mm subsystem.
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
The patch looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply
* Re: [PATCH net v2] flow_dissector: Check skb for VLAN only if skb specified.
From: Jakub Sitnicki @ 2016-10-18 12:44 UTC (permalink / raw)
To: Eric Garver; +Cc: netdev, Hadar Hen Zion
In-Reply-To: <1476736212-21238-1-git-send-email-e@erig.me>
On Mon, Oct 17, 2016 at 08:30 PM GMT, Eric Garver wrote:
> Fixes a panic when calling eth_get_headlen(). Noticed on i40e driver.
>
> Fixes: d5709f7ab776 ("flow_dissector: For stripped vlan, get vlan info from skb->vlan_tci")
> Signed-off-by: Eric Garver <e@erig.me>
> ---
> net/core/flow_dissector.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 1a7b80f73376..44e6ba9d3a6b 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -247,12 +247,10 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
> case htons(ETH_P_8021Q): {
> const struct vlan_hdr *vlan;
>
> - if (skb_vlan_tag_present(skb))
> + if (skb && skb_vlan_tag_present(skb))
> proto = skb->protocol;
>
I was a bit confused that we check skb for VLAN tag again later in the
same block but this time without a NULL check. However, this only
happens when we get called from skb_flow_dissect() or
skb_flow_dissect_flow_keys() variants, which take an skb and pass it to
us.
Feel free to add:
Reviewed-by: Jakub Sitnicki <jkbs@redhat.com>
^ permalink raw reply
* Re: [PATCH 01/10] mm: remove write/force parameters from __get_user_pages_locked()
From: Jan Kara @ 2016-10-18 12:43 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: linux-mips, linux-fbdev, Jan Kara, kvm, linux-sh, Dave Hansen,
dri-devel, linux-mm, netdev, sparclinux, linux-ia64, linux-s390,
linux-samsung-soc, linux-scsi, linux-rdma, x86, Hugh Dickins,
linux-media, Rik van Riel, intel-gfx, adi-buildroot-devel,
ceph-devel, linux-arm-kernel, linux-cris-kernel, Linus Torvalds,
linuxppc-dev, linux-kernel, linux-security-module, linux-alpha,
lin
In-Reply-To: <20161013002020.3062-2-lstoakes@gmail.com>
On Thu 13-10-16 01:20:11, Lorenzo Stoakes wrote:
> This patch removes the write and force parameters from __get_user_pages_locked()
> to make the use of FOLL_FORCE explicit in callers as use of this flag can result
> in surprising behaviour (and hence bugs) within the mm subsystem.
>
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply
* Re: Need help with mdiobus_register and phy
From: Timur Tabi @ 2016-10-18 12:40 UTC (permalink / raw)
To: Zefir Kurtisi, Andrew Lunn; +Cc: Florian Fainelli, netdev
In-Reply-To: <21038884-a76e-1647-9194-be510a2f9da4@neratec.com>
Zefir Kurtisi wrote:
>> I have never seen the original problem that you noticed. When I use the generic
>> phy driver instead of the at803x driver, everything works great for me. Perhaps
>> the problem that you noticed only occurs with the Gianfar NIC?
>>
> You mean it works for you in SGMII mode without glitches?
That is correct.
> Then it might in fact be
> an unfortunate rare or unique combination that we chose.
That is what I expect.
> I'd need some time to get that tested, and since our device might be the only one
> requiring the fix, I am fine with keeping the patch private. Feel free to revert
> it, if required, I'll provide a revised one.
I'm in no hurry to get this fixed. Do you need a couple weeks to run
some tests? It would be good to know for sure that your fix is needed
only on your platform.
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, hosted by The Linux Foundation.
^ permalink raw reply
* [PATCH net] conntrack: restart gc immediately if GC_MAX_EVICTS is reached
From: Nicolas Dichtel @ 2016-10-18 12:37 UTC (permalink / raw)
To: pablo, fw; +Cc: davem, netdev, netfilter-devel, Nicolas Dichtel
In-Reply-To: <34d607cc-5556-89c7-673d-be8cb0a4758a@6wind.com>
When the maximum evictions number is reached, do not wait 5 seconds before
the next run.
CC: Florian Westphal <fw@strlen.de>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
net/netfilter/nf_conntrack_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index ba6a1d421222..df2f5a3901df 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -983,7 +983,7 @@ static void gc_worker(struct work_struct *work)
return;
ratio = scanned ? expired_count * 100 / scanned : 0;
- if (ratio >= 90)
+ if (ratio >= 90 || expired_count == GC_MAX_EVICTS)
next_run = 0;
gc_work->last_bucket = i;
--
2.8.1
^ permalink raw reply related
* Re: [PATCH] net: dsa: properly disconnect the slave PHYs
From: Andrew Lunn @ 2016-10-18 12:29 UTC (permalink / raw)
To: John Crispin
Cc: Vivien Didelot, Florian Fainelli, David S. Miller, netdev,
linux-kernel
In-Reply-To: <1476792760-60356-1-git-send-email-john@phrozen.org>
On Tue, Oct 18, 2016 at 02:12:40PM +0200, John Crispin wrote:
> The shutdown code only stopped the PHYs but does not diconnect them
> properly. This could lead to null pointer deref related kernel oopses
> during reboot. Fix this by calling phy_disconnect() after the PHYs are
> stopped.
Humm, i don't follow this.
The phy is disconnected in dsa_slave_destroy(). Why is that not
sufficient?
Also, after calling dsa_slave_close(), dsa_slave_open() can be
called. But with your change, the phy has gone, so we are going to
have trouble.
Andrew
>
> Signed-off-by: John Crispin <john@phrozen.org>
> ---
> net/dsa/slave.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 68714a5..725d9f7 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -154,8 +154,10 @@ static int dsa_slave_close(struct net_device *dev)
> struct net_device *master = p->parent->dst->master_netdev;
> struct dsa_switch *ds = p->parent;
>
> - if (p->phy)
> + if (p->phy) {
> phy_stop(p->phy);
> + phy_disconnect(p->phy);
> + }
>
> dev_mc_unsync(master, dev);
> dev_uc_unsync(master, dev);
> --
> 1.7.10.4
>
^ permalink raw reply
* [PATCH iproute2] tc, ipt: don't enforce iproute2 dependency on iptables-devel
From: Daniel Borkmann @ 2016-10-18 12:13 UTC (permalink / raw)
To: stephen; +Cc: jhs, mikko.rapeli, tgraf, netdev, netfilter-devel,
Daniel Borkmann
Since 5cd1adba79d3 ("Update to current iptables headers") compilation
of iproute2 broke for systems without iptables-devel package [1].
Reason is that even though we fall back to build m_ipt.c, the include
depends on a xtables-version.h header, which only ships with
iptables-devel. Machines not having this package fail compilation with:
[...]
CC m_ipt.o
In file included from ../include/iptables.h:5:0,
from m_ipt.c:17:
../include/xtables.h:34:29: fatal error: xtables-version.h: No such file or directory
compilation terminated.
../Config:31: recipe for target 'm_ipt.o' failed
make[1]: *** [m_ipt.o] Error 1
The configure script only barks that package xtables was not found in
the pkg-config search path. The generated Config then only contains f.e.
TC_CONFIG_IPSET. In tc's Makefile we thus fall back to adding m_ipt.o
to TCMODULES. m_ipt.c then includes the local include/iptables.h header
copy, which includes the include/xtables.h copy. Latter then includes
xtables-version.h, which only ships with iptables-devel.
One way to resolve this is to skip this whole mess when pkg-config has
no xtables config available. I've carried something along these lines
locally for a while now, but it's just too annyoing. :/ Build works fine
now also when xtables.pc is not available.
[1] http://www.spinics.net/lists/netdev/msg366162.html
Fixes: 5cd1adba79d3 ("Update to current iptables headers")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
---
configure | 33 ++++++++++++++++++++++++---------
tc/Makefile | 29 ++++++++++++++---------------
2 files changed, 38 insertions(+), 24 deletions(-)
diff --git a/configure b/configure
index 60eb6b5..c978da3 100755
--- a/configure
+++ b/configure
@@ -57,6 +57,14 @@ EOF
rm -f $TMPDIR/atmtest.c $TMPDIR/atmtest
}
+check_xtables()
+{
+ if ! ${PKG_CONFIG} xtables --exists
+ then
+ echo "TC_CONFIG_NO_XT:=y" >>Config
+ fi
+}
+
check_xt()
{
#check if we have xtables from iptables >= 1.4.5.
@@ -353,18 +361,25 @@ echo "TC schedulers"
echo -n " ATM "
check_atm
-echo -n " IPT "
-check_xt
-check_xt_old
-check_xt_old_internal_h
-check_ipt
+check_xtables
+if ! grep -q TC_CONFIG_NO_XT Config
+then
+ echo -n " IPT "
+ check_xt
+ check_xt_old
+ check_xt_old_internal_h
+ check_ipt
-echo -n " IPSET "
-check_ipset
+ echo -n " IPSET "
+ check_ipset
+fi
echo
-echo -n "iptables modules directory: "
-check_ipt_lib_dir
+if ! grep -q TC_CONFIG_NO_XT Config
+then
+ echo -n "iptables modules directory: "
+ check_ipt_lib_dir
+fi
echo -n "libc has setns: "
check_setns
diff --git a/tc/Makefile b/tc/Makefile
index 8917eaf..dfa875b 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -69,28 +69,27 @@ TCMODULES += q_clsact.o
TCMODULES += e_bpf.o
TCMODULES += f_matchall.o
-ifeq ($(TC_CONFIG_IPSET), y)
- ifeq ($(TC_CONFIG_XT), y)
- TCMODULES += em_ipset.o
- endif
-endif
-
TCSO :=
ifeq ($(TC_CONFIG_ATM),y)
TCSO += q_atm.so
endif
-ifeq ($(TC_CONFIG_XT),y)
- TCSO += m_xt.so
-else
- ifeq ($(TC_CONFIG_XT_OLD),y)
- TCSO += m_xt_old.so
+ifneq ($(TC_CONFIG_NO_XT),y)
+ ifeq ($(TC_CONFIG_XT),y)
+ TCSO += m_xt.so
+ ifeq ($(TC_CONFIG_IPSET),y)
+ TCMODULES += em_ipset.o
+ endif
else
- ifeq ($(TC_CONFIG_XT_OLD_H),y)
- CFLAGS += -DTC_CONFIG_XT_H
- TCSO += m_xt_old.so
+ ifeq ($(TC_CONFIG_XT_OLD),y)
+ TCSO += m_xt_old.so
else
- TCMODULES += m_ipt.o
+ ifeq ($(TC_CONFIG_XT_OLD_H),y)
+ CFLAGS += -DTC_CONFIG_XT_H
+ TCSO += m_xt_old.so
+ else
+ TCMODULES += m_ipt.o
+ endif
endif
endif
endif
--
1.9.3
^ permalink raw reply related
* [PATCH] net: dsa: properly disconnect the slave PHYs
From: John Crispin @ 2016-10-18 12:12 UTC (permalink / raw)
To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller
Cc: netdev, linux-kernel, John Crispin
The shutdown code only stopped the PHYs but does not diconnect them
properly. This could lead to null pointer deref related kernel oopses
during reboot. Fix this by calling phy_disconnect() after the PHYs are
stopped.
Signed-off-by: John Crispin <john@phrozen.org>
---
net/dsa/slave.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 68714a5..725d9f7 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -154,8 +154,10 @@ static int dsa_slave_close(struct net_device *dev)
struct net_device *master = p->parent->dst->master_netdev;
struct dsa_switch *ds = p->parent;
- if (p->phy)
+ if (p->phy) {
phy_stop(p->phy);
+ phy_disconnect(p->phy);
+ }
dev_mc_unsync(master, dev);
dev_uc_unsync(master, dev);
--
1.7.10.4
^ permalink raw reply related
* RE: [patch net-next RFC 4/6] Introduce sample tc action
From: Yotam Gigi @ 2016-10-18 8:33 UTC (permalink / raw)
To: Or Gerlitz, Jiri Pirko
Cc: Linux Netdev List, David Miller, Ido Schimmel, Elad Raz,
Nogah Frankel, Or Gerlitz, Jamal Hadi Salim,
geert+renesas@glider.be, Stephen Hemminger, Cong Wang,
Guenter Roeck
In-Reply-To: <CAJ3xEMivz1cPutHyyU8_=dvbwmkPCgJYC8xTxF4NHjuSmq8cRw@mail.gmail.com>
>-----Original Message-----
>From: Or Gerlitz [mailto:gerlitz.or@gmail.com]
>Sent: Sunday, October 16, 2016 1:27 PM
>To: Jiri Pirko <jiri@resnulli.us>
>Cc: Linux Netdev List <netdev@vger.kernel.org>; David Miller
><davem@davemloft.net>; Yotam Gigi <yotamg@mellanox.com>; Ido Schimmel
><idosch@mellanox.com>; Elad Raz <eladr@mellanox.com>; Nogah Frankel
><nogahf@mellanox.com>; Or Gerlitz <ogerlitz@mellanox.com>; Jamal Hadi Salim
><jhs@mojatatu.com>; geert+renesas@glider.be; Stephen Hemminger
><stephen@networkplumber.org>; Cong Wang <xiyou.wangcong@gmail.com>;
>Guenter Roeck <linux@roeck-us.net>
>Subject: Re: [patch net-next RFC 4/6] Introduce sample tc action
>
>On Wed, Oct 12, 2016 at 3:41 PM, Jiri Pirko <jiri@resnulli.us> wrote:
>> From: Yotam Gigi <yotam.gi@gmail.com>
>>
>> This action allow the user to sample traffic matched by tc classifier.
>> The sampling consists of choosing packets randomly, truncating them,
>> adding some informative metadata regarding the interface and the original
>> packet size and mark them with specific mark, to allow further tc rules to
>> match and process. The marked sample packets are then injected into the
>> device ingress qdisc using netif_receive_skb.
>>
>> The packets metadata is packed using the ife encapsulation protocol, and
>> the outer packet's ethernet dest, source and eth_type, along with the
>> rate, mark and the optional truncation size can be configured from
>> userspace.
>>
>> Example:
>> To sample ingress traffic from interface eth1, and redirect the sampled
>> the sampled packets to interface dummy0, one may use the commands:
>>
>> tc qdisc add dev eth1 handle ffff: ingress
>>
>> tc filter add dev eth1 parent ffff: \
>> matchall action sample rate 12 mark 17
>>
>> tc filter add parent ffff: dev eth1 protocol all \
>> u32 match mark 172 0xff
>> action mirred egress redirect dev dummy0
>>
>> Where the first command adds an ingress qdisc and the second starts
>> sampling every 12'th packet on dev eth0 and marks the sampled packets with
>> 17. The command third catches the sampled packets, which are marked with
>> 17, and redirects them to dev dummy0.
>
>eth0 --> eth1
>
>command third --> third command
>
Missed that. Thanks :)
>don't we need a re-classify directive for the u32 filter to apply
>after the marking done by the matchall rule + sample action
>or is that implicit?
No, as the packets are re-injected to the ingress qdisc (as described in the
commit message). Reclassify won't work as the sampled packets, which are a copy
of the chosen packets are generated inside the sample action and are not part of
the device packet stream.
>
>
>> diff --git a/include/net/tc_act/tc_sample.h b/include/net/tc_act/tc_sample.h
>> new file mode 100644
>> index 0000000..a2b445a
>> --- /dev/null
>> +++ b/include/net/tc_act/tc_sample.h
>> @@ -0,0 +1,88 @@
>> +#ifndef __NET_TC_SAMPLE_H
>> +#define __NET_TC_SAMPLE_H
>> +
>> +#include <net/act_api.h>
>> +#include <linux/tc_act/tc_sample.h>
>> +
>> +struct tcf_sample {
>> + struct tc_action common;
>> + u32 rate;
>> + u32 mark;
>> + bool truncate;
>> + u32 trunc_size;
>> + u32 packet_counter;
>> + u8 eth_dst[ETH_ALEN];
>> + u8 eth_src[ETH_ALEN];
>> + u16 eth_type;
>> + bool eth_type_set;
>> + struct list_head tcfm_list;
>> +};
>
>> +++ b/include/uapi/linux/tc_act/tc_sample.h
>> @@ -0,0 +1,31 @@
>> +#ifndef __LINUX_TC_SAMPLE_H
>> +#define __LINUX_TC_SAMPLE_H
>> +
>> +#include <linux/types.h>
>> +#include <linux/pkt_cls.h>
>> +#include <linux/if_ether.h>
>> +
>> +#define TCA_ACT_SAMPLE 26
>> +
>> +struct tc_sample {
>> + tc_gen;
>> + __u32 rate; /* sample rate */
>> + __u32 mark; /* mark to put on the sampled packets */
>> + bool truncate; /* whether to truncate the packets */
>> + __u32 trunc_size; /* truncation size */
>> + __u8 eth_dst[ETH_ALEN]; /* encapsulated mac destination */
>> + __u8 eth_src[ETH_ALEN]; /* encapsulated mac source */
>> + bool eth_type_set; /* whether to overrid ethtype */
>> + __u16 eth_type; /* encapsulated mac ethtype */
>> +};
>
>overrid --> override
Fixed. Thanks :)
>
>what do you mean by override here, to encapsulate?
No. It’s the IFE header eth_type.
>
>consider using 0 as special value, e.g no truncation and no encapsulation
>
>best if you just define the netlink attributes (document on the RHS
>the type, see the uapi
>for the new tunnel key action) and let the tc action in-kernel code to
>decode them directly
>into the non UAPI structure. This way you are extendable and also
>avoid having two
>structs which is sort of confusing.
You are right. Will do that.
>
>> +
>> +enum {
>> + TCA_SAMPLE_UNSPEC,
>> + TCA_SAMPLE_TM,
>> + TCA_SAMPLE_PARMS,
>> + TCA_SAMPLE_PAD,
>> + __TCA_SAMPLE_MAX
>> +};
>> +#define TCA_SAMPLE_MAX (__TCA_SAMPLE_MAX - 1)
>> +
>> +#endif
>
>
>> +static bool dev_ok_push(struct net_device *dev)
>> +{
>> + switch (dev->type) {
>> + case ARPHRD_TUNNEL:
>> + case ARPHRD_TUNNEL6:
>> + case ARPHRD_SIT:
>> + case ARPHRD_IPGRE:
>> + case ARPHRD_VOID:
>> + case ARPHRD_NONE:
>> + return false;
>> + default:
>> + return true;
>> + }
>> +}
>> +
>
>> +static int tcf_sample(struct sk_buff *skb, const struct tc_action *a,
>> + struct tcf_result *res)
>> +{
>> + struct tcf_sample *s = to_sample(a);
>> + struct sample_packet_metadata metadata;
>> + static struct ethhdr *ethhdr;
>> + struct sk_buff *skb2;
>> + int retval;
>> + u32 at;
>> +
>> + tcf_lastuse_update(&s->tcf_tm);
>> + bstats_cpu_update(this_cpu_ptr(s->common.cpu_bstats), skb);
>> +
>> + rcu_read_lock();
>> + retval = READ_ONCE(s->tcf_action);
>> +
>> + if (++s->packet_counter % s->rate == 0) {
>> + skb2 = skb_copy(skb, GFP_ATOMIC);
>> + if (!skb2)
>> + goto out;
>> +
>> + if (s->truncate)
>> + skb_trim(skb2, s->trunc_size);
>> +
>> + at = G_TC_AT(skb->tc_verd);
>> + skb2->mac_len = skb->mac_len;
>> +
>> + /* on ingress, the mac header gets poped, so push it back */
>> + if (!(at & AT_EGRESS) && dev_ok_push(skb->dev))
>> + skb_push(skb2, skb2->mac_len);
>> +
>
>what's the exact role of the !(at & AT_EGRESS) check?
Check whether we are in ingress (not in egress). As the doc sais:
/* on ingress, the mac header gets poped, so push it back */
>
>and if !dev_ok_push(.) - are we just fine to continue here without
>that push? maybe
>worth documenting that corner a bit
>
It might be. The ok_push was taken almost as-is from act_mirred.
>
>
>> + metadata.ifindex = skb->dev->ifindex;
>> + metadata.orig_size = skb->len + skb->dev->hard_header_len;
>> + metadata.sample_size = skb2->len;
>> + ethhdr = sample_packet_pack(skb2, (void *)&metadata);
>> + if (!ethhdr)
>> + goto out;
>> +
>> + if (!is_zero_ether_addr(s->eth_src))
>> + ether_addr_copy(ethhdr->h_source, s->eth_src);
>> + if (!is_zero_ether_addr(s->eth_dst))
>> + ether_addr_copy(ethhdr->h_dest, s->eth_dst);
>> + if (s->eth_type_set)
>> + ethhdr->h_proto = htons(s->eth_type);
>> +
>> + skb2->mark = s->mark;
>> + netif_receive_skb(skb2);
>> +
>> + /* mirror is always swallowed */
>> + skb2->tc_verd = SET_TC_FROM(skb2->tc_verd, at);
>> + }
>> +out:
>> + rcu_read_unlock();
>> +
>> + return retval;
>> +}
^ permalink raw reply
* Re: [PATCH 4/9] ipv6: sr: add core files for SR HMAC support
From: David Lebrun @ 2016-10-18 12:07 UTC (permalink / raw)
To: Tom Herbert; +Cc: Linux Kernel Network Developers
In-Reply-To: <CALx6S37FP3_3hp093tg=NWRaYTg_pWY_Yf5odYBYi1vYRjvyfg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 486 bytes --]
On 10/17/2016 07:24 PM, Tom Herbert wrote:
> A lot of this looks generic and potentially useful in other cases
> where we we want to do HMAC over some headers (I'm thinking GUE can
> probably use some of this for header authentication). Might be nice to
> split out the generic pieces at some point.
How would you see this integrated generically ? Directly into the crypto
subsystem ? The idea is interesting anyway, I can work on that after
this patch series goes through.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 2/2] net: phy: Add Fast Link Failure - 2 set driver for Microsemi PHYs.
From: Andrew Lunn @ 2016-10-18 11:49 UTC (permalink / raw)
To: Raju Lakkaraju
Cc: Florian Fainelli, netdev-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
Allan.Nielsen-dzo6w/eZyo2tG0bUXCXiUA
In-Reply-To: <20161018113043.GA19357-dzo6w/eZyo2tG0bUXCXiUA@public.gmane.org>
> Do i need to change Ethtool application and submit along with
> downshift driver patch (i.e. ethtool.c, phy.c, cpsw.c and mscc.c changes) ?
Yes, please submit two patchset. One patchset for ethtool and its man
page and a second patchset for all the kernel changes.
Thanks
Andrew
--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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
* [PATCH net-next] openvswitch: remove unnecessary EXPORT_SYMBOLs
From: Jiri Benc @ 2016-10-18 11:47 UTC (permalink / raw)
To: netdev; +Cc: dev, Pravin Shelar
Many symbols exported to other modules are really used only by
openvswitch.ko. Remove the exports.
Tested by loading all 4 openvswitch modules, nothing breaks.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
net/openvswitch/datapath.c | 2 --
net/openvswitch/vport-netdev.c | 1 -
net/openvswitch/vport.c | 2 --
3 files changed, 5 deletions(-)
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 4d67ea856067..194435aa1165 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -59,7 +59,6 @@
#include "vport-netdev.h"
int ovs_net_id __read_mostly;
-EXPORT_SYMBOL_GPL(ovs_net_id);
static struct genl_family dp_packet_genl_family;
static struct genl_family dp_flow_genl_family;
@@ -131,7 +130,6 @@ int lockdep_ovsl_is_held(void)
else
return 1;
}
-EXPORT_SYMBOL_GPL(lockdep_ovsl_is_held);
#endif
static struct vport *new_vport(const struct vport_parms *);
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
index 4e3972344aa6..e825753de1e0 100644
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -162,7 +162,6 @@ void ovs_netdev_detach_dev(struct vport *vport)
netdev_master_upper_dev_get(vport->dev));
dev_set_promiscuity(vport->dev, -1);
}
-EXPORT_SYMBOL_GPL(ovs_netdev_detach_dev);
static void netdev_destroy(struct vport *vport)
{
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 7387418ac514..f7d4390829af 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -463,7 +463,6 @@ int ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
ovs_dp_process_packet(skb, &key);
return 0;
}
-EXPORT_SYMBOL_GPL(ovs_vport_receive);
static void free_vport_rcu(struct rcu_head *rcu)
{
@@ -479,7 +478,6 @@ void ovs_vport_deferred_free(struct vport *vport)
call_rcu(&vport->rcu, free_vport_rcu);
}
-EXPORT_SYMBOL_GPL(ovs_vport_deferred_free);
static unsigned int packet_length(const struct sk_buff *skb)
{
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH 3/9] ipv6: sr: add support for SRH encapsulation and injection with lwtunnels
From: David Lebrun @ 2016-10-18 11:47 UTC (permalink / raw)
To: Tom Herbert; +Cc: Linux Kernel Network Developers
In-Reply-To: <CALx6S355B9QzYor6AsSfEprE=CODnaJeE_5u9C3CtpMMe4dPog@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
On 10/17/2016 07:17 PM, Tom Herbert wrote:
>> > + err = ip6_dst_lookup(net, sk, &dst, &fl6);
> Please look at the use of dst_cache that I added in ila_lwt.c, I think
> the SR has similar properties and might be able to use dst_cache which
> is a significant performance improvement when source packets from a
> connected socket. The dst_cache will work in LWT as long as the new
> destination address is the same and other input to routing (saddr,
> flow label, mark, etc.) are either always the same or assumed to be
> immaterial to lookup of the second route.
>
Great, thanks :)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ 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