From efd09845c41e08469d6f6bffa23bd90b6bd06e85 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 15 Sep 2014 07:42:33 +0200 Subject: [PATCH] platform: increase NL buffer for systems with lots of interfaces (rh #1141256) Seems like 128k is not enough for systems with many interfaces. This adds 4k per device, while keeping the 128k minimum. Therefore this change only affects systems with more than 32 interfaces. https://bugzilla.redhat.com/show_bug.cgi?id=1141256 --- src/platform/nm-linux-platform.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 8bec9b2d36..73994cc362 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -3971,6 +3971,7 @@ udev_device_added (NMPlatform *platform, const char *ifname; int ifindex; gboolean was_announceable = FALSE; + int nle; ifname = g_udev_device_get_name (udev_device); if (!ifname) { @@ -4001,6 +4002,12 @@ udev_device_added (NMPlatform *platform, g_hash_table_insert (priv->udev_devices, GINT_TO_POINTER (ifindex), g_object_ref (udev_device)); + /* Grow the netlink socket buffer beyond 128k if we have more that 32 interfaces. */ + nle = nl_socket_set_buffer_size (priv->nlh_event, + MAX (131072, 4096 * g_hash_table_size (priv->udev_devices)), 0); + if (nle) + warning ("udev-add: failed to adjust netlink socket buffer size"); + /* Announce devices only if they also have been discovered via Netlink. */ if (rtnllink && link_is_announceable (platform, rtnllink)) announce_object (platform, (struct nl_object *) rtnllink, was_announceable ? NM_PLATFORM_SIGNAL_CHANGED : NM_PLATFORM_SIGNAL_ADDED, NM_PLATFORM_REASON_EXTERNAL);