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
This commit is contained in:
Lubomir Rintel
2014-09-15 07:42:33 +02:00
committed by Jiří Klimeš
parent a36a3a9a52
commit efd09845c4

View File

@@ -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);