Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756864AbZFDPOk (ORCPT ); Thu, 4 Jun 2009 11:14:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753580AbZFDPO3 (ORCPT ); Thu, 4 Jun 2009 11:14:29 -0400 Received: from mail-bw0-f213.google.com ([209.85.218.213]:61865 "EHLO mail-bw0-f213.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751692AbZFDPO2 convert rfc822-to-8bit (ORCPT ); Thu, 4 Jun 2009 11:14:28 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Z4UrMQHASQUrPCTKlPtwdcHpSFmzZp9Hr/eTMwRoIHn+acJOSYIj9HsWr9wiMfryf/ UdNwCnxD2iZZF58Q5SAw+BoB6Pwj/XtboDx2XWCAYmJAQgqGG5TxX7VJ4N0fYFoAI3GZ kDLjroAfYg9vVGVITpEA2Hm4olUlrA6jUJ7hM= MIME-Version: 1.0 In-Reply-To: <4A27E448.3040305@trash.net> References: <1244021629-18409-4-git-send-email-dbaryshkov@gmail.com> <1244021629-18409-5-git-send-email-dbaryshkov@gmail.com> <1244021964.10665.5.camel@johannes.local> <20090603.030911.162861804.davem@davemloft.net> <20090603105256.GB20508@doriath.ww600.siemens.net> <1244027110.1693.9.camel@johannes.local> <20090603122744.GC20508@doriath.ww600.siemens.net> <1244124749.22576.71.camel@johannes.local> <4A27E448.3040305@trash.net> Date: Thu, 4 Jun 2009 19:14:28 +0400 Message-ID: Subject: Re: [PATCH 4/6] net: add NL802154 interface for configuration of 802.15.4 devices From: Dmitry Eremin-Solenikov To: Patrick McHardy Cc: Johannes Berg , David Miller , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, sfr@canb.auug.org.au, slapin@ossfans.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1845 Lines: 80 2009/6/4 Patrick McHardy : > Dmitry Eremin-Solenikov wrote: >> >> 2009/6/4 Johannes Berg : >>> >>> On Wed, 2009-06-03 at 16:27 +0400, Dmitry Eremin-Solenikov wrote: >>> >>>>>> +static int ieee802154_nl_put_failure(struct sk_buff *msg) >>>>>> +{ >>>>>> + void *hdr = genlmsg_data(NLMSG_DATA(msg->data)); /* XXX: nlh is >>>>>> right at the start of msg */ >>>>>> + genlmsg_cancel(msg, hdr); >>>>>> + nlmsg_free(msg); >>>>>> + return -ENOBUFS; >>>>>> +} >>>>> >>>>> This seems weird. >>>> >>>> Why? >>> >>> Because it's strange to cancel then free? >> >>> From looking at the other code, the usual pattern for netlink is >> >> (please, correct me if I'm wrong): >> >> int fill (....) >> { >> ? genlmsg_put(); >> ? NLA_PUT(...) >> ? NLA_PUT(...) >> ? return genlmsg_end(); >> >> nla_put_failure: >> ? genlmsg_cancel(); >> ? return -EMSGSIZE; >> } >> >> int cmd(...) >> { >> ? ?int rc; >> ? ?nlmsg_new(); >> >> ? ?rc = fill(); >> ? ?if (rc < 0) >> ? ? ? ?goto out; >> >> ? ?genlmsg_unicast(); >> >> out: >> ? ?nlmsg_free(); >> ? ?return -ENOBUFS; >> } >> >> This is equivalent to our code: >> >> sk_buff *new() >> { >> ? msg = nlmsg_new(); >> ? genlmsg_put(); >> ? return msg; >> } > > canceling messages is only necessary in fill functions that are > also used for dumps, where as many elements are stuffed in the > skb as possible. When the last element doesn't completely fit, > its removed again (canceled) and put into the next skb. Understood. So you'd suggest just to drop the genlmsg_cancel() from the failure call chain? -- With best wishes Dmitry -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/