backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Updating id field in backports genl family
@ 2018-05-24 10:57 Aaron Komisar
  0 siblings, 0 replies; 12+ messages in thread
From: Aaron Komisar @ 2018-05-24 10:57 UTC (permalink / raw)
  To: backports; +Cc: Aaron Komisar

Family ID from the original family struct will be used when building
genl messages (sent as nlmsg_type), so the new id should be updated in
the original (older kernel format) family struct too

Signed-off-by: Aaron Komisar <aaron.komisar@tandemg.com>
---
 backport/compat/backport-4.12.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/backport/compat/backport-4.12.c b/backport/compat/backport-4.12.c
index 2372a11..4948b53 100644
--- a/backport/compat/backport-4.12.c
+++ b/backport/compat/backport-4.12.c
@@ -225,6 +225,13 @@ int bp_extack_genl_register_family(struct genl_family *family)
 	/* copy this since the family might access it directly */
 	family->id = copy->family.id;
 	family->attrbuf = copy->family.attrbuf;
+
+	/* family ID from the original family struct will be used when building
+	 * genl messages (sent as nlmsg_type), so the new id should be updated
+	 * in the original (older kernel format) family struct too
+	 */
+	family->family.id = copy->family.id;
+
 #if LINUX_VERSION_IS_GEQ(3,13,0)
 	family->mcgrp_offset = copy->family.mcgrp_offset;
 #endif
-- 
2.7.4

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

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-26  6:07   ` Wan-Hua Chang
@ 2018-06-26  6:54     ` Aaron Komisar
  0 siblings, 0 replies; 12+ messages in thread
From: Aaron Komisar @ 2018-06-26  6:54 UTC (permalink / raw)
  To: Wan-Hua Chang, Johannes Berg; +Cc: backports, Chi-Hsien.Lin@cypress.com

On Tue, Jun 26, 2018 at 09:07:13PM +0300, Wan-Hua Chang wrote:

>> Looking at this again ...
>>=20
>> > I see the patch causes compiling error becasue family->family is not
>> > found when LINUX_VERSION >=3D 3.13
>>=20
>> Yeah, that seems right.
>>=20
>> > backports/backport/backport-include/genetlink.h
>> > struct backport_genl_fmaily is only defined when LINUX_VERSION < 3.13
>> >=20
>> >=20
>> > And in backports/backport/compat/backport-3.13.c line 127=20
>> >=20
>> > family->id =3D family->family.id
>> >=20
>> > it looks like this line has done what the patch want to do. Is the
>> > comprehension correct?
>>=20
>> I don't think so. We call this function - via
>> __real_bp_extack_genl_register_family() - on copy->family, so we do need
>> to copy like Aaron said, we just need to make it conditional for kernel
>> < 3.13 because on 3.13 we don't use this sub-family thing.
>>=20
>> I've committed a fix - does that work for both of you? Aaron?
>Hi Johannes,=20
>Yes, the fix works for me, thanks.
Same here.
Thanks!
>
>>=20
>> johannes
    =
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-25 16:40 ` Johannes Berg
@ 2018-06-26  6:07   ` Wan-Hua Chang
  2018-06-26  6:54     ` Aaron Komisar
  0 siblings, 1 reply; 12+ messages in thread
From: Wan-Hua Chang @ 2018-06-26  6:07 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports, Chi-Hsien.Lin, Aaron Komisar

On Mon, Jun 25, 2018 at 06:40:13PM +0200, Johannes Berg wrote:
> Looking at this again ...
> 
> > I see the patch causes compiling error becasue family->family is not
> > found when LINUX_VERSION >= 3.13
> 
> Yeah, that seems right.
> 
> > backports/backport/backport-include/genetlink.h
> > struct backport_genl_fmaily is only defined when LINUX_VERSION < 3.13
> > 
> > 
> > And in backports/backport/compat/backport-3.13.c line 127 
> > 
> > family->id = family->family.id
> > 
> > it looks like this line has done what the patch want to do. Is the
> > comprehension correct?
> 
> I don't think so. We call this function - via
> __real_bp_extack_genl_register_family() - on copy->family, so we do need
> to copy like Aaron said, we just need to make it conditional for kernel
> < 3.13 because on 3.13 we don't use this sub-family thing.
> 
> I've committed a fix - does that work for both of you? Aaron?
Hi Johannes, 
Yes, the fix works for me, thanks.

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

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-11 10:29 Wan-Hua Chang
  2018-06-11 12:25 ` Johannes Berg
@ 2018-06-25 16:40 ` Johannes Berg
  2018-06-26  6:07   ` Wan-Hua Chang
  1 sibling, 1 reply; 12+ messages in thread
From: Johannes Berg @ 2018-06-25 16:40 UTC (permalink / raw)
  To: Wan-Hua Chang, backports; +Cc: Chi-Hsien.Lin, Aaron Komisar

Looking at this again ...

> I see the patch causes compiling error becasue family->family is not
> found when LINUX_VERSION >= 3.13

Yeah, that seems right.

> backports/backport/backport-include/genetlink.h
> struct backport_genl_fmaily is only defined when LINUX_VERSION < 3.13
> 
> 
> And in backports/backport/compat/backport-3.13.c line 127 
> 
> family->id = family->family.id
> 
> it looks like this line has done what the patch want to do. Is the
> comprehension correct?

I don't think so. We call this function - via
__real_bp_extack_genl_register_family() - on copy->family, so we do need
to copy like Aaron said, we just need to make it conditional for kernel
< 3.13 because on 3.13 we don't use this sub-family thing.

I've committed a fix - does that work for both of you? Aaron?

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

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-21 14:14         ` Aaron Komisar
@ 2018-06-21 14:17           ` Johannes Berg
  0 siblings, 0 replies; 12+ messages in thread
From: Johannes Berg @ 2018-06-21 14:17 UTC (permalink / raw)
  To: Aaron Komisar, Wan-Hua Chang; +Cc: backports, chi-hsien.lin

On Thu, 2018-06-21 at 14:14 +0000, Aaron Komisar wrote:
> On Mon, 2018-06-21 at 13:12 +0300, Wan-Hua Chang wrote:
> > Hi Aaron,
> > 
> > Since you want to backport from Linux v4.4.92 drivers to Linux v3.10.104
> > kernel, you can use "git checkout linux-4.4.y" to set backports git to
> > 4.4. With this version, there is no backport-4.12.c created and this
> > file is not needed in your case as well. If you use backports master
> > branch it supposes you want to backports Linux latest drivers to
> > v3.10.104.
> > 
> 
> I am doing the development on a recent kernel (4.16) and the target kernel is
> either v3.10.104 or v4.4.92.

Yeah, I think we just need to put the right ifdef on that id assignment?

We might even have that already internally, I'll check.

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

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-21 10:12       ` Wan-Hua Chang
@ 2018-06-21 14:14         ` Aaron Komisar
  2018-06-21 14:17           ` Johannes Berg
  0 siblings, 1 reply; 12+ messages in thread
From: Aaron Komisar @ 2018-06-21 14:14 UTC (permalink / raw)
  To: Wan-Hua Chang; +Cc: Johannes Berg, backports, chi-hsien.lin

On Mon, 2018-06-21 at 13:12 +0300, Wan-Hua Chang wrote:
>Hi Aaron,
>
>Since you want to backport from Linux v4.4.92 drivers to Linux v3.10.104
>kernel, you can use "git checkout linux-4.4.y" to set backports git to
>4.4. With this version, there is no backport-4.12.c created and this
>file is not needed in your case as well. If you use backports master
>branch it supposes you want to backports Linux latest drivers to
>v3.10.104.
>

I am doing the development on a recent kernel (4.16) and the target kernel =
is
either v3.10.104 or v4.4.92.

Thanks,
Aaron=
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-12 12:10     ` Aaron Komisar
  2018-06-13 10:30       ` Wan-Hua Chang
@ 2018-06-21 10:12       ` Wan-Hua Chang
  2018-06-21 14:14         ` Aaron Komisar
  1 sibling, 1 reply; 12+ messages in thread
From: Wan-Hua Chang @ 2018-06-21 10:12 UTC (permalink / raw)
  To: Aaron Komisar; +Cc: Johannes Berg, backports, chi-hsien.lin

Hi Aaron,

Since you want to backport from Linux v4.4.92 drivers to Linux v3.10.104
kernel, you can use "git checkout linux-4.4.y" to set backports git to
4.4. With this version, there is no backport-4.12.c created and this
file is not needed in your case as well. If you use backports master
branch it supposes you want to backports Linux latest drivers to
v3.10.104.

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

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-12 12:10     ` Aaron Komisar
@ 2018-06-13 10:30       ` Wan-Hua Chang
  2018-06-21 10:12       ` Wan-Hua Chang
  1 sibling, 0 replies; 12+ messages in thread
From: Wan-Hua Chang @ 2018-06-13 10:30 UTC (permalink / raw)
  To: Aaron Komisar; +Cc: Johannes Berg, backports, chi-hsien.lin

On Tue, Jun 12, 2018 at 12:10:36PM +0000, Aaron Komisar wrote:
> 
> On  6/12/2018 4:50, Chi-hsien Lin wrote:
> >On 06/11/2018 8:25, Johannes Berg wrote:
> >> On Mon, 2018-06-11 at 05:29 -0500, Wan-Hua Chang wrote:
> >>> Hi,
> >>>
> >>> I see the patch causes compiling error becasue family->family is not
> >>> found when LINUX_VERSION >= 3.13
> >>>
> >>> backports/backport/backport-include/genetlink.h
> >>> struct backport_genl_fmaily is only defined when LINUX_VERSION < 3.13
> >>>
> 
> I built backports-output for recent kernels (4.4.92, for example) and didn't get any compilation errors.
> Which version are you using?

I am using target kernel version 4.1.15. In this case, I can see
compiling error that family->family is not found.

> 
> >>>
> >>> And in backports/backport/compat/backport-3.13.c line 127
> >>>
> >>> family->id = family->family.id
> >>>
> >>> it looks like this line has done what the patch want to do. Is the
> >>> comprehension correct?
> 
> This line does update family id, but it gets **copy**->family.
> copy->family.id in backport-4.12.c is changed, but family->family.id remains unchanged.
> 
> >> 
> >> I guess we have to put an ifdef around this ...
> >> 
> >> Aaron?
> >
> >Hi Aaron,
> >
> >As Wan-Hua mentioned, it looks like backport-3.13.c line 127 syncs back 
> >the id for backport_genl_family structure for kernel < 3.13 already.
> >
> >Could you please share more details about the failure you saw without 
> >this change? What's the kernel version you used?
> >
> 
> I am using target kernel version 3.10.104.
> The problem I saw was that a driver using family id after calling genl_register_family would always get 0 instead of the actual value.
> 
> >
> >Regards,
> >Chi-hsien Lin
> >
> >> 
> >> johannes
> > .
> > 
> 
> Aaron
>     
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-12  1:50   ` Chi-Hsien Lin
@ 2018-06-12 12:10     ` Aaron Komisar
  2018-06-13 10:30       ` Wan-Hua Chang
  2018-06-21 10:12       ` Wan-Hua Chang
  0 siblings, 2 replies; 12+ messages in thread
From: Aaron Komisar @ 2018-06-12 12:10 UTC (permalink / raw)
  To: Johannes Berg, Wan-Hua Chang, backports, chi-hsien.lin


On  6/12/2018 4:50, Chi-hsien Lin wrote:
>On 06/11/2018 8:25, Johannes Berg wrote:
>> On Mon, 2018-06-11 at 05:29 -0500, Wan-Hua Chang wrote:
>>> Hi,
>>>
>>> I see the patch causes compiling error becasue family->family is not
>>> found when LINUX_VERSION >=3D 3.13
>>>
>>> backports/backport/backport-include/genetlink.h
>>> struct backport_genl_fmaily is only defined when LINUX_VERSION < 3.13
>>>

I built backports-output for recent kernels (4.4.92, for example) and didn'=
t get any compilation errors.
Which version are you using?

>>>
>>> And in backports/backport/compat/backport-3.13.c line 127
>>>
>>> family->id =3D family->family.id
>>>
>>> it looks like this line has done what the patch want to do. Is the
>>> comprehension correct?

This line does update family id, but it gets **copy**->family.
copy->family.id in backport-4.12.c is changed, but family->family.id remain=
s unchanged.

>>=20
>> I guess we have to put an ifdef around this ...
>>=20
>> Aaron?
>
>Hi Aaron,
>
>As Wan-Hua mentioned, it looks like backport-3.13.c line 127 syncs back=20
>the id for backport_genl_family structure for kernel < 3.13 already.
>
>Could you please share more details about the failure you saw without=20
>this change? What's the kernel version you used?
>

I am using target kernel version 3.10.104.
The problem I saw was that a driver using family id after calling genl_regi=
ster_family would always get 0 instead of the actual value.

>
>Regards,
>Chi-hsien Lin
>
>>=20
>> johannes
> .
>=20

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

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-11 12:25 ` Johannes Berg
@ 2018-06-12  1:50   ` Chi-Hsien Lin
  2018-06-12 12:10     ` Aaron Komisar
  0 siblings, 1 reply; 12+ messages in thread
From: Chi-Hsien Lin @ 2018-06-12  1:50 UTC (permalink / raw)
  To: Johannes Berg, Wan-Hua Chang, backports, Aaron Komisar



On 06/11/2018 8:25, Johannes Berg wrote:
> On Mon, 2018-06-11 at 05:29 -0500, Wan-Hua Chang wrote:
>> Hi,
>>
>> I see the patch causes compiling error becasue family->family is not
>> found when LINUX_VERSION >= 3.13
>>
>> backports/backport/backport-include/genetlink.h
>> struct backport_genl_fmaily is only defined when LINUX_VERSION < 3.13
>>
>>
>> And in backports/backport/compat/backport-3.13.c line 127
>>
>> family->id = family->family.id
>>
>> it looks like this line has done what the patch want to do. Is the
>> comprehension correct?
> 
> I guess we have to put an ifdef around this ...
> 
> Aaron?

Hi Aaron,

As Wan-Hua mentioned, it looks like backport-3.13.c line 127 syncs back 
the id for backport_genl_family structure for kernel < 3.13 already.

Could you please share more details about the failure you saw without 
this change? What's the kernel version you used?


Regards,
Chi-hsien Lin

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

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

* Re: [PATCH] Updating id field in backports genl family
  2018-06-11 10:29 Wan-Hua Chang
@ 2018-06-11 12:25 ` Johannes Berg
  2018-06-12  1:50   ` Chi-Hsien Lin
  2018-06-25 16:40 ` Johannes Berg
  1 sibling, 1 reply; 12+ messages in thread
From: Johannes Berg @ 2018-06-11 12:25 UTC (permalink / raw)
  To: Wan-Hua Chang, backports, Aaron Komisar; +Cc: Chi-Hsien.Lin

On Mon, 2018-06-11 at 05:29 -0500, Wan-Hua Chang wrote:
> Hi,
> 
> I see the patch causes compiling error becasue family->family is not
> found when LINUX_VERSION >= 3.13
> 
> backports/backport/backport-include/genetlink.h
> struct backport_genl_fmaily is only defined when LINUX_VERSION < 3.13
> 
> 
> And in backports/backport/compat/backport-3.13.c line 127 
> 
> family->id = family->family.id
> 
> it looks like this line has done what the patch want to do. Is the
> comprehension correct?

I guess we have to put an ifdef around this ...

Aaron?

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

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

* Re: [PATCH] Updating id field in backports genl family
@ 2018-06-11 10:29 Wan-Hua Chang
  2018-06-11 12:25 ` Johannes Berg
  2018-06-25 16:40 ` Johannes Berg
  0 siblings, 2 replies; 12+ messages in thread
From: Wan-Hua Chang @ 2018-06-11 10:29 UTC (permalink / raw)
  To: backports; +Cc: Chi-Hsien.Lin

Hi,

I see the patch causes compiling error becasue family->family is not
found when LINUX_VERSION >= 3.13

backports/backport/backport-include/genetlink.h
struct backport_genl_fmaily is only defined when LINUX_VERSION < 3.13


And in backports/backport/compat/backport-3.13.c line 127 

family->id = family->family.id

it looks like this line has done what the patch want to do. Is the
comprehension correct?
--
To unsubscribe from this list: send the line "unsubscribe backports" in

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

end of thread, other threads:[~2018-06-26  6:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 10:57 [PATCH] Updating id field in backports genl family Aaron Komisar
2018-06-11 10:29 Wan-Hua Chang
2018-06-11 12:25 ` Johannes Berg
2018-06-12  1:50   ` Chi-Hsien Lin
2018-06-12 12:10     ` Aaron Komisar
2018-06-13 10:30       ` Wan-Hua Chang
2018-06-21 10:12       ` Wan-Hua Chang
2018-06-21 14:14         ` Aaron Komisar
2018-06-21 14:17           ` Johannes Berg
2018-06-25 16:40 ` Johannes Berg
2018-06-26  6:07   ` Wan-Hua Chang
2018-06-26  6:54     ` Aaron Komisar

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).