From patchwork Fri Jan 10 13:11:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Aleksandrov X-Patchwork-Id: 309269 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BD77A2C009E for ; Sat, 11 Jan 2014 00:16:58 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756834AbaAJNQw (ORCPT ); Fri, 10 Jan 2014 08:16:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48874 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756708AbaAJNQu (ORCPT ); Fri, 10 Jan 2014 08:16:50 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0ADGoLd032336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 10 Jan 2014 08:16:50 -0500 Received: from boza.brq.redhat.com (beastie.brq.redhat.com [10.34.1.132]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s0ADGlOl027356; Fri, 10 Jan 2014 08:16:49 -0500 From: Nikolay Aleksandrov To: netdev@vger.kernel.org Cc: Nikolay Aleksandrov Subject: [RFC net-next 1/3] bonding: add infrastructure for an option API Date: Fri, 10 Jan 2014 14:11:33 +0100 Message-Id: <1389359495-9700-2-git-send-email-nikolay@redhat.com> In-Reply-To: <1389359495-9700-1-git-send-email-nikolay@redhat.com> References: <1389359495-9700-1-git-send-email-nikolay@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds the necessary basic infrastructure to support centralized and unified option manipulation API for the bonding. The new structure bond_option will be used to describe each option with its dependencies on modes which will be checked automatically thus removing a lot of duplicated code. Also automatic range checking is added for non-string options. Currently the option setting function requires RTNL to be acquired prior to calling it, since many options already rely on RTNL it seemed like the best choice to protect all against common race conditions. In order to add an option the following steps need to be done: 1. Add an entry BOND_OPT_