netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: nicolas.dichtel@6wind.com
Cc: netdev@vger.kernel.org
Subject: Re: [RFC PATCH net-next 2/3] rtnl/ipv6: use netconf msg to advertise forwarding status
Date: Tue, 23 Oct 2012 13:29:40 -0400 (EDT)	[thread overview]
Message-ID: <20121023.132940.1732325493436273627.davem@davemloft.net> (raw)
In-Reply-To: <1350985789-24966-3-git-send-email-nicolas.dichtel@6wind.com>

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue, 23 Oct 2012 11:49:48 +0200

> +static int inet6_fill_netconf_devconf(struct sk_buff *skb, int ifindex,
> +				      struct ipv6_devconf *devconf, u32 portid,
> +				      u32 seq, int event, unsigned int flags)
> +{
> +	struct nlmsghdr  *nlh;
> +	struct netconfmsg *ncm;
> +
> +	nlh = nlmsg_put(skb, portid, seq, event, sizeof(struct netconfmsg),
> +			flags);
> +	if (nlh == NULL)
> +		return -EMSGSIZE;
> +
> +	ncm = nlmsg_data(nlh);
> +	ncm->ncm_family = AF_INET6;
> +
> +	if (nla_put_s32(skb, NETCONFA_IFINDEX, ifindex) < 0) {
> +		nlmsg_cancel(skb, nlh);
> +		return -EMSGSIZE;
> +	}
> +	if (nla_put_s32(skb, NETCONFA_FORWARDING, devconf->forwarding) < 0) {
> +		nlmsg_cancel(skb, nlh);
> +		return -EMSGSIZE;
> +	}
> +
> +	return nlmsg_end(skb, nlh);
> +}

Don't report values that aren't changing, that's wasteful.

You need to therefore provide a ->get() operation, so that when
a daemon starts up which is interested in these values, it can
fetch the initial state.

That's why you should only report the differences in the events,
rather than unconditionally reporting all the values all the
time, whether they change or not.

  reply	other threads:[~2012-10-23 17:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23  9:49 [RFC PATCH net-next 0/1] Allow to monitor protocol configuration Nicolas Dichtel
2012-10-23  9:49 ` [RFC PATCH net-next 1/3] rtnl: add a new type of msg to advertise " Nicolas Dichtel
2012-10-23  9:49 ` [RFC PATCH net-next 2/3] rtnl/ipv6: use netconf msg to advertise forwarding status Nicolas Dichtel
2012-10-23 17:29   ` David Miller [this message]
2012-10-24 16:02     ` [RFC PATCH net-next v2 0/5] Allow to monitor protocol configuration Nicolas Dichtel
2012-10-24 16:02       ` [RFC PATCH net-next v2 1/5] rtnl: add a new type of msg to advertise " Nicolas Dichtel
2012-10-24 16:02       ` [RFC PATCH net-next v2 2/5] rtnl/ipv6: use netconf msg to advertise forwarding status Nicolas Dichtel
2012-10-26  6:18         ` David Miller
2012-10-26  8:28           ` [PATCH net-next v3 0/5] Allow to monitor protocol configuration Nicolas Dichtel
2012-10-26  8:28             ` [PATCH net-next v3 1/5] rtnl: add a new type of msg to advertise " Nicolas Dichtel
2012-10-26  8:28             ` [PATCH net-next v3 2/5] rtnl/ipv6: use netconf msg to advertise forwarding status Nicolas Dichtel
2012-10-26  8:28             ` [PATCH net-next v3 3/5] rtnl/ipv6: add support of RTM_GETNETCONF Nicolas Dichtel
2012-10-26  8:28             ` [PATCH net-next v3 4/5] rtnl/ipv4: use netconf msg to advertise forwarding status Nicolas Dichtel
2012-10-26  8:28             ` [PATCH net-next v3 5/5] rtnl/ipv4: add support of RTM_GETNETCONF Nicolas Dichtel
2012-10-28 23:05             ` [PATCH net-next v3 0/5] Allow to monitor protocol configuration David Miller
2012-10-26  9:03           ` [RFC PATCH net-next v2 2/5] rtnl/ipv6: use netconf msg to advertise forwarding status David Laight
2012-10-26  9:17             ` David Miller
2012-10-24 16:02       ` [RFC PATCH net-next v2 3/5] rtnl/ipv6: add support of RTM_GETNETCONF Nicolas Dichtel
2012-10-24 16:02       ` [RFC PATCH net-next v2 4/5] rtnl/ipv4: use netconf msg to advertise forwarding status Nicolas Dichtel
2012-10-24 16:02       ` [RFC PATCH net-next v2 5/5] rtnl/ipv4: add support of RTM_GETNETCONF Nicolas Dichtel
2012-10-26  6:19       ` [RFC PATCH net-next v2 0/5] Allow to monitor protocol configuration David Miller
2012-10-23  9:49 ` [RFC PATCH net-next 3/3] rtnl/ipv4: use netconf msg to advertise forwarding status Nicolas Dichtel
2012-10-23  9:54 ` [RFC PATCH iproute2] ip: allow to monitor netconf messages Nicolas Dichtel
2012-10-23 12:52   ` Stephen Hemminger

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=20121023.132940.1732325493436273627.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).