All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Philippe Gerum <rpm@xenomai.org>, xenomai@xenomai.org
Subject: Re: [PATCH 06/12] net/rtdev: ensure per-device skbs get mapped at registration
Date: Wed, 6 Feb 2019 10:08:47 +0100	[thread overview]
Message-ID: <90796ec9-0260-dba1-4b43-d53de1fbb355@siemens.com> (raw)
In-Reply-To: <0289e2ee-b8e4-8b23-adaf-98221394d9e3@xenomai.org>

On 06.02.19 10:02, Philippe Gerum wrote:
> On 1/24/19 7:24 PM, Jan Kiszka wrote:
>> On 24.01.19 16:34, Philippe Gerum wrote:
>>> This patch works around a regression introduced by #74464ee37d0,
>>> causing a new device's skbs not to be passed to its ->map_rtskb()
>>> handler when registered, breaking further DMA inits in the driver.
>>>
>>> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
>>> ---
>>>    kernel/drivers/net/stack/rtdev.c | 37 +++++++++++++++++++++++---------
>>>    1 file changed, 27 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/kernel/drivers/net/stack/rtdev.c
>>> b/kernel/drivers/net/stack/rtdev.c
>>> index 631ca1804..286d08cb1 100644
>>> --- a/kernel/drivers/net/stack/rtdev.c
>>> +++ b/kernel/drivers/net/stack/rtdev.c
>>> @@ -45,6 +45,7 @@ struct rtnet_device
>>> *rtnet_devices[MAX_RT_DEVICES];
>>>    static struct rtnet_device  *loopback_device;
>>>    static DEFINE_RTDM_LOCK(rtnet_devices_rt_lock);
>>>    static LIST_HEAD(rtskb_mapped_list);
>>> +static LIST_HEAD(rtskb_mapwait_list);
>>>      LIST_HEAD(event_hook_list);
>>>    DEFINE_MUTEX(rtnet_devices_nrt_lock);
>>> @@ -459,8 +460,12 @@ int rtdev_map_rtskb(struct rtskb *skb)
>>>        }
>>>        }
>>>    -    if (!err && skb->buf_dma_addr != RTSKB_UNMAPPED)
>>> -    list_add(&skb->entry, &rtskb_mapped_list);
>>> +    if (!err) {
>>> +        if (skb->buf_dma_addr != RTSKB_UNMAPPED)
>>> +            list_add(&skb->entry, &rtskb_mapped_list);
>>> +        else
>>> +            list_add(&skb->entry, &rtskb_mapwait_list);
>>> +    }
>>>          mutex_unlock(&rtnet_devices_nrt_lock);
>>>    @@ -471,19 +476,31 @@ int rtdev_map_rtskb(struct rtskb *skb)
>>>      static int rtdev_map_all_rtskbs(struct rtnet_device *rtdev)
>>>    {
>>> -    struct rtskb *skb;
>>> -    int err = 0;
>>> +    struct rtskb *skb, *n;
>>> +    int err;
>>>          if (!rtdev->map_rtskb)
>>> -    return 0;
>>> +        return 0;
>>>    -    list_for_each_entry(skb, &rtskb_mapped_list, entry) {
>>> -    err = rtskb_map(rtdev, skb);
>>> -    if (err)
>>> -       break;
>>> +    if (!list_empty(&rtskb_mapped_list)) {
>>
>> Why this extra check? list_for_each_entry should just do nothing if the
>> list is empty.
>>
>>> +        list_for_each_entry(skb, &rtskb_mapped_list, entry) {
>>> +            err = rtskb_map(rtdev, skb);
>>> +            if (err)
>>> +                return err;
>>> +        }
>>>        }
>>>    -    return err;
>>> +    if (!list_empty(&rtskb_mapwait_list)) {
>>
>> Same here.
>>
>>> +        list_for_each_entry_safe(skb, n, &rtskb_mapwait_list, entry) {
>>> +            err = rtskb_map(rtdev, skb);
>>> +            if (err)
>>> +                return err;
>>> +            list_del(&skb->entry);
>>> +            list_add(&skb->entry, &rtskb_mapped_list);
>>> +        }
>>> +    }
>>> +
>>> +    return 0;
>>>    }
>>>     
>>
>> Style mix: Eventually, we should switch all RTnet code to kernel style.
>> For now, we have 4-space-indention, and we should keep it until then.
>> Mixing things will only make it more messy.
>>
> 
> There is a massive commit [1] pending in my queue fixing RTnet wrt
> coding style, which I'm not going to paste here. This is the result of
> filtering the code through scripts/Lindent basically.
> 
> Would you agree on merging such kind of commit into RTnet? If so, the
> vlan and multicast support I'm currently adapting from Gilles' past work
> should go on top of such changes.

I would take such cleanup. It's a timing issue, though, because any further 
stable fixes that come after that may be harder to backport. New feature are 
fine afterwards, of course.

Jan

> 
> [1]
> https://lab.xenomai.org/xenomai-rpm.git/commit/?h=for-upstream/next&id=d6cab66ddaf4e01cd9166dc530acc60c5b3bd3c2
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


  reply	other threads:[~2019-02-06  9:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 15:34 [PATCH 00/12] Assorted updates: RTnet, GPIO, smokey tests Philippe Gerum
2019-01-24 15:34 ` [PATCH 01/12] testsuite/smokey: posix_clock: prevent false positive in time-dependent test Philippe Gerum
2019-01-24 15:34 ` [PATCH 02/12] drivers/gpio: provide optional timestamped readouts Philippe Gerum
2019-01-24 18:17   ` Jan Kiszka
2019-01-25  9:15     ` Philippe Gerum
2019-01-25  9:23       ` Jan Kiszka
2019-01-25  9:31         ` Philippe Gerum
2019-01-25  9:33           ` Jan Kiszka
2019-01-25  9:38             ` Philippe Gerum
2019-01-25  9:48               ` Jan Kiszka
2019-01-25 10:11                 ` Philippe Gerum
2019-01-25 11:32                   ` Jan Kiszka
2019-01-25 11:42                     ` Philippe Gerum
2019-01-25 13:46                       ` Jan Kiszka
2019-01-24 15:34 ` [PATCH 03/12] testsuite/gpiotest: enable timestamping on 'timestamp' argument Philippe Gerum
2019-01-24 15:34 ` [PATCH 04/12] net/stack: allow initializing pre-allocated device structs Philippe Gerum
2019-01-24 15:34 ` [PATCH 05/12] net/stack: fresh rtskb should have ip_summed set to CHECKSUM_NONE Philippe Gerum
2019-01-24 18:21   ` Jan Kiszka
2019-01-25  9:26     ` Philippe Gerum
2019-01-24 15:34 ` [PATCH 06/12] net/rtdev: ensure per-device skbs get mapped at registration Philippe Gerum
2019-01-24 18:24   ` Jan Kiszka
2019-02-06  9:02     ` Philippe Gerum
2019-02-06  9:08       ` Jan Kiszka [this message]
2019-02-06  9:47         ` Philippe Gerum
2019-01-24 15:34 ` [PATCH 07/12] net/udp: getfrag: fix frag preparation status Philippe Gerum
2019-01-24 15:34 ` [PATCH 08/12] net/udp: getfrag: remove direct reference to user memory Philippe Gerum
2019-01-24 15:34 ` [PATCH 09/12] testsuite/smokey: net: do not unload pre-loaded modules Philippe Gerum
2019-01-24 15:34 ` [PATCH 10/12] testsuite/smokey: net: do not down a previously running test interface Philippe Gerum
2019-01-24 15:34 ` [PATCH 11/12] net/stack: rtskb: do not run nop locking calls Philippe Gerum
2019-01-24 15:34 ` [PATCH 12/12] testsuite/smokey: net_client: improve stats readability Philippe Gerum
2019-01-24 18:10 ` [PATCH 00/12] Assorted updates: RTnet, GPIO, smokey tests Jan Kiszka
2019-01-25  9:12   ` Philippe Gerum
2019-01-25  9:20     ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90796ec9-0260-dba1-4b43-d53de1fbb355@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.