From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29679C2D0E4 for ; Fri, 20 Nov 2020 15:26:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B635522252 for ; Fri, 20 Nov 2020 15:26:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727655AbgKTPZw (ORCPT ); Fri, 20 Nov 2020 10:25:52 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:41448 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbgKTPZv (ORCPT ); Fri, 20 Nov 2020 10:25:51 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kg8IG-008857-4u; Fri, 20 Nov 2020 16:25:48 +0100 Date: Fri, 20 Nov 2020 16:25:48 +0100 From: Andrew Lunn To: Huazhong Tan Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, kuba@kernel.org, mkubecek@suse.cz Subject: Re: [RFC V2 net-next 1/2] ethtool: add support for controling the type of adaptive coalescing Message-ID: <20201120152548.GN1853236@lunn.ch> References: <1605853479-4483-1-git-send-email-tanhuazhong@huawei.com> <1605853479-4483-2-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1605853479-4483-2-git-send-email-tanhuazhong@huawei.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > @@ -310,6 +334,13 @@ int ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info) > ret = dev->ethtool_ops->set_coalesce(dev, &coalesce); > if (ret < 0) > goto out_ops; > + > + if (ops->set_ext_coalesce) { > + ret = ops->set_ext_coalesce(dev, &ext_coalesce); > + if (ret < 0) > + goto out_ops; > + } > + The problem here is, if ops->set_ext_coalesce() fails, you need to undo what dev->ethtool_ops->set_coalesce() did. From the users perspective, this should be atomic. It does everything, or it does nothing and returns an error code. And that is not easy given this structure of two op calls. Andrew