Commit 936c9917 authored by Jan Kiszka's avatar Jan Kiszka

rtnet: Fix lifecycle management of mapped rtskbs

Do not add rtskbs to the rtskb_list which are not mappend because
rtdev_unmap_rtskb will not remove such rtskbs again (buf_dma_addr ==
RTSKB_UNMAPPED). In fact, rtskb_list should be called rtskb_mapped_list,
so refactor this while at it.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 98b1559f
......@@ -44,9 +44,9 @@ MODULE_PARM_DESC(device_rtskbs, "Number of additional global realtime socket "
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);
LIST_HEAD(event_hook_list);
LIST_HEAD(rtskb_list);
DEFINE_MUTEX(rtnet_devices_nrt_lock);
static int rtdev_locked_xmit(struct rtskb *skb, struct rtnet_device *rtdev);
......@@ -412,8 +412,8 @@ int rtdev_map_rtskb(struct rtskb *skb)
}
}
if (!err)
list_add(&skb->entry, &rtskb_list);
if (!err && skb->buf_dma_addr != RTSKB_UNMAPPED)
list_add(&skb->entry, &rtskb_mapped_list);
mutex_unlock(&rtnet_devices_nrt_lock);
......@@ -430,7 +430,7 @@ static int rtdev_map_all_rtskbs(struct rtnet_device *rtdev)
if (!rtdev->map_rtskb)
return 0;
list_for_each_entry(skb, &rtskb_list, entry) {
list_for_each_entry(skb, &rtskb_mapped_list, entry) {
err = rtskb_map(rtdev, skb);
if (err)
break;
......@@ -474,7 +474,7 @@ static void rtdev_unmap_all_rtskbs(struct rtnet_device *rtdev)
if (!rtdev->unmap_rtskb)
return;
list_for_each_entry(skb, &rtskb_list, entry) {
list_for_each_entry(skb, &rtskb_mapped_list, entry) {
rtdev->unmap_rtskb(rtdev, skb);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment