backports: fixes for wireless-testing
PATCH 2/4 backports: add backport for idr_remove
In reply to Arend van SprielSince commit d3e709e63e97 ("idr: Return the deleted entry from idr_remove") the function signature changed so provide a backport which does a idr_find() and subsequent idr_remove().
---
Hi Johannes,
Not sure if the find/remove approach is a good one here. Better solutions are welcome.
Regards,
Arend
--- backport/backport-include/linux/idr.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
backport/backport-include/linux/idr.h +10 -0
@@ -61,4 +61,14 @@ static inline void idr_preload_end(void) for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id)#endif +#if LINUX_VERSION_IS_LESS (4 ,11 ,0 ) +static inline void *backport_idr_remove (struct idr *idr,int id) +{ +void *item =idr_find (idr, id); +idr_remove (idr, id); +return item; +} +#define idr_remove backport_idr_remove +#endif +#endif /* __BACKPORT_IDR_H */
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe backports" in
cover backports: fixes for wireless-testing
This series fixes backport issues found backporting the wireless-testing tree that moved to 4.11-rc1.
Arend van Spriel (4):
patches: update crypto-ccm.patch for v4.11-rc1
backports: add backport for idr_remove
backports: introduce new definition for DECLARE_EWMA macro
backports: add dummy include/linux/sched/signal.h
backport/backport-include/linux/average.h | 65 +++++++++++++++++--------- backport/backport-include/linux/idr.h | 10 ++++ backport/backport-include/linux/sched/signal.h | 10 ++++ patches/crypto-ccm.patch | 9 ++-- 4 files changed, 69 insertions(+), 25 deletions(-) create mode 100644 backport/backport-include/linux/sched/signal.h
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 1/4 patches: update crypto-ccm.patch for v4.11-rc1
Since v4.11-rc1 the patch file for crypto/ccm.c, which is incorporated in the compat module, no longer applies. Update the patch file to fix the issue.
--- patches/crypto-ccm.patch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
patches/crypto-ccm.patch +5 -4
@@ -1,7 +1,7 @@ --- a/compat/crypto-ccm.c +++ b/compat/crypto-ccm.c -@@ -13,13 +13,44 @@ - #include <crypto/internal/aead.h> +@@ -14,13 +14,44 @@ + #include <crypto/internal/hash.h> #include <crypto/internal/skcipher.h> #include <crypto/scatterwalk.h> +#include <crypto/algapi.h>
@@ -46,7 +46,7 @@ struct ccm_instance_ctx { struct crypto_skcipher_spawn ctr; -@@ -897,7 +928,7 @@ static struct crypto_template crypto_rfc +@@ -1001,7 +1032,7 @@ static int cbcmac_create(struct crypto_template *tmpl, struct rtattr **tb) .module = THIS_MODULE, };
@@ -55,7 +55,7 @@ { int err; -@@ -923,18 +954,9 @@ out_undo_base: +@@ -1033,19 +1064,10 @@ static int __init crypto_ccm_module_init(void) goto out; }
@@ -65,6 +65,7 @@ crypto_unregister_template(&crypto_rfc4309_tmpl); crypto_unregister_template(&crypto_ccm_tmpl); crypto_unregister_template(&crypto_ccm_base_tmpl); + crypto_unregister_template(&crypto_cbcmac_tmpl); } - -module_init(crypto_ccm_module_init);
Signature · 4 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 3/4 backports: introduce new definition for DECLARE_EWMA macro
In reply to Arend van SprielSince commit eb1e011a1474 ("average: change to declare precision, not factor") the definition of DECLARE_EWMA has changed so we need a backport for the new macro as it differs. Changing the strategy by checking the kernel version and #undef the macro to be sure we do not run into macro redefinition issue.
--- backport/backport-include/linux/average.h | 65 +++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 21 deletions(-)
backport/backport-include/linux/average.h +44 -21
@@ -2,45 +2,68 @@#define __BACKPORT_AVERAGE#include_next <linux/average.h> -#ifndef DECLARE_EWMA -#define DECLARE_EWMA (name, _factor, _weight) \ +/* +* Exponentially weighted moving average (EWMA) +* +* This implements a fixed-precision EWMA algorithm, with both the +* precision and fall-off coefficient determined at compile-time +* and built into the generated helper funtions. +* +* The first argument to the macro is the name that will be used +* for the struct and helper functions. +* +* The second argument, the precision, expresses how many bits are +* used for the fractional part of the fixed-precision values. +* +* The third argument, the weight reciprocal, determines how the +* new values will be weighed vs. the old state, new values will +* get weight 1/weight_rcp and old values 1-1/weight_rcp. Note +* that this parameter must be a power of two for efficiency. +*/ +#if LINUX_VERSION_IS_LESS (4 ,11 ,0 ) +#undef DECLARE_EWMA +#define DECLARE_EWMA (name, _precision, _weight_rcp) \ struct ewma_##name { \ unsigned long internal; \ }; \ static inline void ewma_##name##_init(struct ewma_##name *e) \ { \ - BUILD_BUG_ON(!__builtin_constant_p(_factor)); \ - BUILD_BUG_ON(!__builtin_constant_p(_weight)); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_factor); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_weight); \ + BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ + BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ +/* \ +* Even if you want to feed it just 0/1 you should have \ +* some bits for the non-fractional part... \ +*/ \ +BUILD_BUG_ON ((_precision) >30 ); \ +BUILD_BUG_ON_NOT_POWER_OF_2 (_weight_rcp); \ e->internal =0 ; \ } \ static inline unsigned long \ ewma_##name##_read(struct ewma_##name *e) \ { \ - BUILD_BUG_ON(!__builtin_constant_p(_factor)); \ - BUILD_BUG_ON(!__builtin_constant_p(_weight)); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_factor); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_weight); \ - return e->internal >> ilog2(_factor); \ + BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ + BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ + BUILD_BUG_ON((_precision) > 30); \ + BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ + return e->internal >> (_precision); \ } \ static inline void ewma_##name##_add(struct ewma_##name *e, \ unsigned long val) \ { \ unsigned long internal = ACCESS_ONCE(e->internal); \ - unsigned long weight = ilog2(_weight); \ - unsigned long factor = ilog2(_factor); \ + unsigned long weight_rcp = ilog2(_weight_rcp); \ + unsigned long precision = _precision; \ \ - BUILD_BUG_ON(!__builtin_constant_p(_factor)); \ - BUILD_BUG_ON(!__builtin_constant_p(_weight)); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_factor); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_weight); \ + BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ + BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ + BUILD_BUG_ON((_precision) > 30); \ + BUILD_BUG_ON_NOT_POWER_OF_2(_weight_rcp); \ \ ACCESS_ONCE(e->internal) = internal ? \ - (((internal << weight) - internal) + \ - (val << factor)) >> weight : \ - (val << factor); \ + (((internal << weight_rcp) - internal) + \ + (val << precision)) >> weight_rcp : \ + (val << precision); \ } -#endif /* DECLARE_EWMA */ +#endif /* LINUX_VERSION_IS_LESS(4, 11, 0) */ #endif /* __BACKPORT_AVERAGE */
Signature · 4 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 4/4 backports: add dummy include/linux/sched/signal.h
In reply to Arend van SprielSimply including linux/sched.h for older kernels not carrying this file. This new include file was introduced by commit 3f07c0144132 ("sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h>").
--- backport/backport-include/linux/sched/signal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 backport/backport-include/linux/sched/signal.h
backport/backport-include/linux/sched/signal.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _BACKPORT_LINUX_SCHED_SIGNAL_H +#define _BACKPORT_LINUX_SCHED_SIGNAL_H + +#if LINUX_VERSION_IS_LESS (4 ,11 ,0 ) +#include <linux/sched.h> +#else +#include_next <linux/sched/signal.h> +#endif + +#endif /* _BACKPORT_LINUX_SCHED_SIGNAL_H */
Signature · 4 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe backports" in
Re: [PATCH 1/4] patches: update crypto-ccm.patch for v4.11-rc1
In reply to Arend van SprielQuoted 4 lines · Arend van Spriel
Since v4.11-rc1 the patch file for
crypto/ccm.c, which is incorporated
in the compat module, no longer applies. Update the patch file to fix the issue.
I think I want to get rid of this ccm thing entirely, any objections? As I remember, it doesn't actually work properly anyway.
I suspect that if we really can't do anything else, we'd have to provide a backport for all of crypto/, but I don't want to go there and would rather mandate that all the crypto things are enabled in the base kernel.
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Re: [PATCH 3/4] backports: introduce new definition for DECLARE_EWMA macro
In reply to Arend van SprielQuoted 5 lines · Arend van Spriel
Since commit
eb1e011a1474("average: change to declare precision, not factor") the definition ofDECLARE_EWMAhas changed so we need a backport for the new macro as it differs. Changing the strategy by checking the kernel version and #undef the macro to be sure we do not run into macro redefinition issue.
Good one. However, why not just add this file to copy-list and be done with it? That way, the original one from the kernel will never be included at all and we'll always have the right version. Not that I think we'll change it much, but why not make it easier?
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Re: [PATCH 1/4] patches: update crypto-ccm.patch for v4.11-rc1
In reply to Johannes BergQuoted 8 lines · Johannes Berg
Quoted 4 lines · Arend van Spriel
Since v4.11-rc1 the patch file for
crypto/ccm.c, which is incorporated
in the compat module, no longer applies. Update the patch file to fix the issue.I think I want to get rid of this ccm thing entirely, any objections? As I remember, it doesn't actually work properly anyway.
No objection here. Does the same apply to skcipher stuff?
Quoted 4 lines
I suspect that if we really can't do anything else, we'd have to provide a backport for all of
crypto/, but I don't want to go there and would rather mandate that all the crypto things are enabled in the base kernel.
But that can only work when crypto api in base kernel and backport kernel are the same, right?
Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Re: [PATCH 1/4] patches: update crypto-ccm.patch for v4.11-rc1
Quoted 9 lines · Arend Van Spriel
Quoted 7 lines · Johannes Berg
Quoted 5 lines · Arend van Spriel
Since v4.11-rc1 the patch file for
crypto/ccm.c, which is incorporated
in the compat module, no longer applies. Update the patch file to fix
the issue.
Quoted 5 lines
Quoted 3 lines
I think I want to get rid of this ccm thing entirely, any objections?
As I remember, it doesn't actually work properly anyway.No objection here. Does the same apply to skcipher stuff?
I think so, but not sure.
Quoted 9 lines
Quoted 6 lines
I suspect that if we really can't do anything else, we'd have to provide a backport for all of
crypto/, but I don't want to go there and
would rather mandate that all the crypto things are enabled in the base
kernel.But that can only work when crypto api in base kernel and backport kernel are the same, right?
No, I meant adding all of crypto/ to copy-list and making sure *that* works across kernels ...
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Re: [PATCH 3/4] backports: introduce new definition for DECLARE_EWMA macro
In reply to Johannes BergQuoted 11 lines · Johannes Berg
Quoted 5 lines · Arend van Spriel
Since commit
eb1e011a1474("average: change to declare precision, not factor") the definition ofDECLARE_EWMAhas changed so we need a backport for the new macro as it differs. Changing the strategy by checking the kernel version and #undef the macro to be sure we do not run into macro redefinition issue.Good one. However, why not just add this file to copy-list and be done with it? That way, the original one from the kernel will never be included at all and we'll always have the right version. Not that I think we'll change it much, but why not make it easier?
That will work as long a linux/average.h only contains DECLARE_EWMA and that is all the backported code cares about. So for now the copy-list approach will work. Maybe add a comment in the copy-list documenting the approach.
Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Re: [PATCH 1/4] patches: update crypto-ccm.patch for v4.11-rc1
In reply to Johannes BergQuoted 25 lines · Johannes Berg
Quoted 9 lines · Arend Van Spriel
Quoted 7 lines · Johannes Berg
Quoted 5 lines · Arend van Spriel
Since v4.11-rc1 the patch file for
crypto/ccm.c, which is incorporated
in the compat module, no longer applies. Update the patch file to fix
the issue.Quoted 5 lines
Quoted 3 lines
I think I want to get rid of this ccm thing entirely, any objections?
As I remember, it doesn't actually work properly anyway.No objection here. Does the same apply to skcipher stuff?
I think so, but not sure.
Quoted 7 lines
Quoted 6 lines
I suspect that if we really can't do anything else, we'd have to provide a backport for all of
crypto/, but I don't want to go there and
would rather mandate that all the crypto things are enabled in the base
kernel.
Quoted 5 lines
Quoted 2 lines
But that can only work when crypto api in base kernel and backport kernel are the same, right?
No, I meant adding all of
crypto/to copy-list and making sure *that* works across kernels ...
Understand. There seem to have been significant changes in crypto land making this a challenge. Still seems like right idea.
Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Re: [PATCH 1/4] patches: update crypto-ccm.patch for v4.11-rc1
Quoted 7 lines
Quoted 4 lines
No, I meant adding all of
crypto/to copy-list and making sure *that*
works across kernels ...Understand. There seem to have been significant changes in crypto land making this a challenge. Still seems like right idea.
I'm not really sure it's the right idea, it seems like it'll be quite complicated ... :)
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Re: [PATCH 3/4] backports: introduce new definition for DECLARE_EWMA macro
In reply to Arend Van SprielQuoted 6 lines
That will work as long a
linux/average.honly containsDECLARE_EWMAand that is all the backported code cares about. So for now the copy- list approach will work. Maybe add a comment in the copy-list documenting the approach.
I think it's highly unlikely it'll ever contain anything else.
Will you respin this, or did you want me to handle it?
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
Johannes Berg
AppliedQuoted 9 lines · Arend van Spriel
This series fixes backport issues found backporting the wireless- testing
tree that moved to 4.11-rc1.Arend van Spriel (4):
patches: update crypto-ccm.patch for v4.11-rc1
backports: add backport foridr_remove
backports: introduce new definition forDECLARE_EWMAmacro
backports: add dummyinclude/linux/sched/signal.h
Applied, except I replaced the average.h by just copying that file
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in