backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] backports: Add return value to backport_pci_disable_link_state()
@ 2019-11-16 18:36 Hauke Mehrtens
  2019-11-16 18:36 ` [PATCH 2/3] backports: Adapt to changes to skb_get_hash_perturb() Hauke Mehrtens
  2019-11-16 18:36 ` [PATCH 3/3] backports: Add kvcalloc() Hauke Mehrtens
  0 siblings, 2 replies; 7+ messages in thread
From: Hauke Mehrtens @ 2019-11-16 18:36 UTC (permalink / raw)
  To: backports; +Cc: johannes, Hauke Mehrtens

Since Linux upstream commit 4cfd21885592 ("PCI: let
pci_disable_link_state propagate errors") The
backport_pci_disable_link_state() function can return an error. This
return code is now used by the mt76 driver.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/pci.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/backport/backport-include/linux/pci.h b/backport/backport-include/linux/pci.h
index 84c4e8f6..f0aacbf6 100644
--- a/backport/backport-include/linux/pci.h
+++ b/backport/backport-include/linux/pci.h
@@ -236,4 +236,13 @@ static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
 	(PCI_IRQ_LEGACY | PCI_IRQ_MSI | PCI_IRQ_MSIX)
 #endif
 
+#if LINUX_VERSION_IS_LESS(5,3,0)
+static inline int backport_pci_disable_link_state(struct pci_dev *pdev, int state)
+{
+	pci_disable_link_state(pdev, state);
+	return 0;
+}
+#define pci_disable_link_state LINUX_BACKPORT(pci_disable_link_state)
+#endif /* < 5.3 */
+
 #endif /* _BACKPORT_LINUX_PCI_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* [PATCH 2/3] backports: Adapt to changes to skb_get_hash_perturb()
  2019-11-16 18:36 [PATCH 1/3] backports: Add return value to backport_pci_disable_link_state() Hauke Mehrtens
@ 2019-11-16 18:36 ` Hauke Mehrtens
  2019-11-19  9:00   ` Johannes Berg
  2019-11-16 18:36 ` [PATCH 3/3] backports: Add kvcalloc() Hauke Mehrtens
  1 sibling, 1 reply; 7+ messages in thread
From: Hauke Mehrtens @ 2019-11-16 18:36 UTC (permalink / raw)
  To: backports; +Cc: johannes, Hauke Mehrtens

The skb_get_hash_perturb() function now takes a siphash_key_t instead of
an u32. This was changed in commit 55667441c84f ("net/flow_dissector:
switch to siphash"). Use the correct type in the fq header file
depending on the kernel version.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 patches/0091-fq-no-siphash_key_t/fq.patch | 36 +++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 patches/0091-fq-no-siphash_key_t/fq.patch

diff --git a/patches/0091-fq-no-siphash_key_t/fq.patch b/patches/0091-fq-no-siphash_key_t/fq.patch
new file mode 100644
index 00000000..95c28a19
--- /dev/null
+++ b/patches/0091-fq-no-siphash_key_t/fq.patch
@@ -0,0 +1,36 @@
+--- a/include/net/fq.h
++++ b/include/net/fq.h
+@@ -69,7 +69,15 @@ struct fq {
+ 	struct list_head backlogs;
+ 	spinlock_t lock;
+ 	u32 flows_cnt;
++#if LINUX_VERSION_IS_GEQ(5,3,10) || \
++    LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
++    LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
++    LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
++    LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
+ 	siphash_key_t	perturbation;
++#else
++	u32 perturbation;
++#endif
+ 	u32 limit;
+ 	u32 memory_limit;
+ 	u32 memory_usage;
+--- a/include/net/fq_impl.h
++++ b/include/net/fq_impl.h
+@@ -108,7 +108,15 @@ begin:
+ 
+ static u32 fq_flow_idx(struct fq *fq, struct sk_buff *skb)
+ {
++#if LINUX_VERSION_IS_GEQ(5,3,10) || \
++    LINUX_VERSION_IN_RANGE(4,19,83, 4,20,0) || \
++    LINUX_VERSION_IN_RANGE(4,14,153, 4,15,0) || \
++    LINUX_VERSION_IN_RANGE(4,9,200, 4,10,0) || \
++    LINUX_VERSION_IN_RANGE(4,4,200, 4,5,0)
+ 	u32 hash = skb_get_hash_perturb(skb, &fq->perturbation);
++#else
++	u32 hash = skb_get_hash_perturb(skb, fq->perturbation);
++#endif
+ 
+ 	return reciprocal_scale(hash, fq->flows_cnt);
+ }
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* [PATCH 3/3] backports: Add kvcalloc()
  2019-11-16 18:36 [PATCH 1/3] backports: Add return value to backport_pci_disable_link_state() Hauke Mehrtens
  2019-11-16 18:36 ` [PATCH 2/3] backports: Adapt to changes to skb_get_hash_perturb() Hauke Mehrtens
@ 2019-11-16 18:36 ` Hauke Mehrtens
  2019-11-19  8:59   ` Johannes Berg
  1 sibling, 1 reply; 7+ messages in thread
From: Hauke Mehrtens @ 2019-11-16 18:36 UTC (permalink / raw)
  To: backports; +Cc: johannes, Hauke Mehrtens

kvcalloc() was added in kernel commit 1c542f38ab8d ("mm: Introduce
kvcalloc()") and is now used by the fq header filers.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/mm.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/backport/backport-include/linux/mm.h b/backport/backport-include/linux/mm.h
index b28156d3..8ff7d6a6 100644
--- a/backport/backport-include/linux/mm.h
+++ b/backport/backport-include/linux/mm.h
@@ -50,4 +50,12 @@ static inline void *kvzalloc(size_t size, gfp_t flags)
 }
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,18,0)
+#define kvcalloc LINUX_BACKPORT(kvcalloc)
+static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
+{
+	return kvmalloc_array(n, size, flags | __GFP_ZERO);
+}
+#endif /* < 4.18 */
+
 #endif /* __BACKPORT_MM_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 3/3] backports: Add kvcalloc()
  2019-11-16 18:36 ` [PATCH 3/3] backports: Add kvcalloc() Hauke Mehrtens
@ 2019-11-19  8:59   ` Johannes Berg
  2019-11-19 19:12     ` Hauke Mehrtens
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Berg @ 2019-11-19  8:59 UTC (permalink / raw)
  To: Hauke Mehrtens, backports

On Sat, 2019-11-16 at 19:36 +0100, Hauke Mehrtens wrote:
> kvcalloc() was added in kernel commit 1c542f38ab8d ("mm: Introduce
> kvcalloc()") and is now used by the fq header filers.

Oops, I did the same some time ago but forgot to send it out.

> +{
> +	return kvmalloc_array(n, size, flags | __GFP_ZERO);

I did end up wondering though if __GFP_ZERO actually worked on all old
kernels?

johannes

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 2/3] backports: Adapt to changes to skb_get_hash_perturb()
  2019-11-16 18:36 ` [PATCH 2/3] backports: Adapt to changes to skb_get_hash_perturb() Hauke Mehrtens
@ 2019-11-19  9:00   ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2019-11-19  9:00 UTC (permalink / raw)
  To: Hauke Mehrtens, backports

On Sat, 2019-11-16 at 19:36 +0100, Hauke Mehrtens wrote:
> The skb_get_hash_perturb() function now takes a siphash_key_t instead of
> an u32. This was changed in commit 55667441c84f ("net/flow_dissector:
> switch to siphash"). Use the correct type in the fq header file
> depending on the kernel version.


Thanks, I was trying to figure this out recently but hadn't gotten that
far...

johannes

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 3/3] backports: Add kvcalloc()
  2019-11-19  8:59   ` Johannes Berg
@ 2019-11-19 19:12     ` Hauke Mehrtens
  2019-11-19 19:38       ` Johannes Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Hauke Mehrtens @ 2019-11-19 19:12 UTC (permalink / raw)
  To: Johannes Berg, backports

On 11/19/19 9:59 AM, Johannes Berg wrote:
> On Sat, 2019-11-16 at 19:36 +0100, Hauke Mehrtens wrote:
>> kvcalloc() was added in kernel commit 1c542f38ab8d ("mm: Introduce
>> kvcalloc()") and is now used by the fq header filers.
> 
> Oops, I did the same some time ago but forgot to send it out.
> 
>> +{
>> +	return kvmalloc_array(n, size, flags | __GFP_ZERO);
> 
> I did end up wondering though if __GFP_ZERO actually worked on all old
> kernels?

__GFP_ZERO is at least defined on old kernel versions. I haven't seen an
error when building against 3.14 for example and it is already used
somewhere else in this file.

Hauke
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH 3/3] backports: Add kvcalloc()
  2019-11-19 19:12     ` Hauke Mehrtens
@ 2019-11-19 19:38       ` Johannes Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Berg @ 2019-11-19 19:38 UTC (permalink / raw)
  To: Hauke Mehrtens, backports

On Tue, 2019-11-19 at 20:12 +0100, Hauke Mehrtens wrote:
> On 11/19/19 9:59 AM, Johannes Berg wrote:
> > On Sat, 2019-11-16 at 19:36 +0100, Hauke Mehrtens wrote:
> > > kvcalloc() was added in kernel commit 1c542f38ab8d ("mm: Introduce
> > > kvcalloc()") and is now used by the fq header filers.
> > 
> > Oops, I did the same some time ago but forgot to send it out.
> > 
> > > +{
> > > +	return kvmalloc_array(n, size, flags | __GFP_ZERO);
> > 
> > I did end up wondering though if __GFP_ZERO actually worked on all old
> > kernels?
> 
> __GFP_ZERO is at least defined on old kernel versions. I haven't seen an
> error when building against 3.14 for example and it is already used
> somewhere else in this file.

I know. I just have a vague recollection it didn't always work for any
kind of allocation. I guess I should go search tomorrow...

johannes

--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

end of thread, other threads:[~2019-11-19 19:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-16 18:36 [PATCH 1/3] backports: Add return value to backport_pci_disable_link_state() Hauke Mehrtens
2019-11-16 18:36 ` [PATCH 2/3] backports: Adapt to changes to skb_get_hash_perturb() Hauke Mehrtens
2019-11-19  9:00   ` Johannes Berg
2019-11-16 18:36 ` [PATCH 3/3] backports: Add kvcalloc() Hauke Mehrtens
2019-11-19  8:59   ` Johannes Berg
2019-11-19 19:12     ` Hauke Mehrtens
2019-11-19 19:38       ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).