platform: optimize event_notification() not to create full nmp-objects for delete-events
For delete-events, we only need a shallow object with the key fields set. That sufficies to lookup in the cache and find the object to delete. One other issue is that _nmp_vt_cmd_plobj_init_from_nl_link() and link_extract_type() might call to ethtool for the already deleted instance. Just avoid that. https://bugzilla.redhat.com/show_bug.cgi?id=1247156
This commit is contained in:
@@ -2305,11 +2305,25 @@ event_notification (struct nl_msg *msg, gpointer user_data)
|
||||
if (_support_user_ipv6ll_still_undecided() && msghdr->nlmsg_type == RTM_NEWLINK)
|
||||
_support_user_ipv6ll_detect ((struct rtnl_link *) nlo);
|
||||
|
||||
obj = nmp_object_from_nl (platform, nlo, FALSE, TRUE);
|
||||
switch (msghdr->nlmsg_type) {
|
||||
case RTM_DELADDR:
|
||||
case RTM_DELLINK:
|
||||
case RTM_DELROUTE:
|
||||
/* The event notifies about a deleted object. We don't need to initialize all the
|
||||
* fields of the nmp-object. Shortcut nmp_object_from_nl(). */
|
||||
obj = nmp_object_from_nl (platform, nlo, TRUE, TRUE);
|
||||
_LOGD ("event-notification: %s, seq %u: %s",
|
||||
_nl_nlmsg_type_to_str (msghdr->nlmsg_type, buf_nlmsg_type, sizeof (buf_nlmsg_type)),
|
||||
msghdr->nlmsg_seq, nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_ID, NULL, 0));
|
||||
break;
|
||||
default:
|
||||
obj = nmp_object_from_nl (platform, nlo, FALSE, TRUE);
|
||||
_LOGD ("event-notification: %s, seq %u: %s",
|
||||
_nl_nlmsg_type_to_str (msghdr->nlmsg_type, buf_nlmsg_type, sizeof (buf_nlmsg_type)),
|
||||
msghdr->nlmsg_seq, nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
|
||||
break;
|
||||
}
|
||||
|
||||
_LOGD ("event-notification: %s, seq %u: %s",
|
||||
_nl_nlmsg_type_to_str (msghdr->nlmsg_type, buf_nlmsg_type, sizeof (buf_nlmsg_type)),
|
||||
msghdr->nlmsg_seq, nmp_object_to_string (obj, NMP_OBJECT_TO_STRING_PUBLIC, NULL, 0));
|
||||
if (obj) {
|
||||
auto_nmp_obj NMPObject *obj_cache = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user