From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 94CA7199B6 for ; Fri, 2 Feb 2018 16:16:48 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id r78so13117396wme.0 for ; Fri, 02 Feb 2018 07:16:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=FoYO4RFdz1WFapMg7Vm8naPO8VRMtNKzLpvorsM4tRQ=; b=vv80fc97XHCUHvEVj1AAD41WKT+o4h3KBES7l8PVErABB3ql6kJ52ilAafxy1ZkI+E xuiVkA7E8bgofnle8u8Ena/SG5+euS1yxxbGX7Qxr+RfyE8ANWNXgCE7neA6HyT/TXit j2dj9KdIW/Hk3HFwVScXdO8ArHHH4DKSFpmJT4AkdMz1mQLv1qesVOLZGGEmG2gF2Gfl KVEqVJ6SzmbUozcsulrhzrECODL1ge2XvmHjA7ItGVm3mTGolLXVsg7PJuPfiD++8p74 ilbspeRhFlNkjSXyhxHM393sqZ/nzjfau2tmA9G77GnTKHT5oAU3zS8gXq2lhp1YN9S4 vbxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FoYO4RFdz1WFapMg7Vm8naPO8VRMtNKzLpvorsM4tRQ=; b=ANFNHGq378izxD1ZEKzN7DD60UsvUtWv++Rm7Q5L7NJQLmW2guDJft9evWPRRFXpyK XcDYMa3XNCtYfl7q0oaUGWNADGWQmLvFPm69PMnDRdvxm8bN3SvJ+VcZ3gOF7dHdWSpZ r1X6abIGSMZ8u32Ndzb9XPpIEyTFGR5HzSCr7xZIdT+G5iEVyoVnWWRP/8hnGgfOpLr9 JuwTv+sCpmo5DYehmSGm57LivMVyy7y0OdBJFyXROw8TF5o+ZFBJmsZbIEh8sh57RyIE NJUdOwPofGVfgFy7XottlcPd9AWTfiJCJ1XZFp6L2bImFEzKCxRm+k5VmRFqUllRkSo5 AsEw== X-Gm-Message-State: AKwxytePcaxOLAnUI8oTA8jsmnnQAAzF9BlA9EJCd6+9G9USWlCwZZWe J7D51lv61FlNFJrxWMEpT5ibIfwh X-Google-Smtp-Source: AH8x2279FA3LDTR1RFC8E5/2XKrt4CMyXpoJWU1SS+4ANYbprT/LcdqF27XXw/MIVfZFB2yqfZ9mlg== X-Received: by 10.80.135.205 with SMTP id 13mr69511164edz.253.1517584608265; Fri, 02 Feb 2018 07:16:48 -0800 (PST) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id r9sm1845732edm.59.2018.02.02.07.16.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Feb 2018 07:16:47 -0800 (PST) Date: Fri, 2 Feb 2018 16:16:35 +0100 From: Adrien Mazarguil To: Shahaf Shuler Cc: Nelio Laranjeiro , dev@dpdk.org, Marcelo Ricardo Leitner Message-ID: <20180202144736.8239-2-adrien.mazarguil@6wind.com> References: <20180202144736.8239-1-adrien.mazarguil@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180202144736.8239-1-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH v1 1/4] net/mlx: add debug checks to glue structure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Feb 2018 15:16:48 -0000 This code should catch mistakes early if a glue structure member is added without a corresponding implementation in the library. Signed-off-by: Adrien Mazarguil --- drivers/net/mlx4/mlx4.c | 9 +++++++++ drivers/net/mlx5/mlx5.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 50a55ee52..201d39b6e 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -799,6 +799,15 @@ rte_mlx4_pmd_init(void) return; assert(mlx4_glue); #endif +#ifndef NDEBUG + /* Glue structure must not contain any NULL pointers. */ + { + unsigned int i; + + for (i = 0; i != sizeof(*mlx4_glue) / sizeof(void *); ++i) + assert(((const void *const *)mlx4_glue)[i]); + } +#endif mlx4_glue->fork_init(); rte_pci_register(&mlx4_driver); } diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 544599b01..050cfac0d 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1142,6 +1142,15 @@ rte_mlx5_pmd_init(void) return; assert(mlx5_glue); #endif +#ifndef NDEBUG + /* Glue structure must not contain any NULL pointers. */ + { + unsigned int i; + + for (i = 0; i != sizeof(*mlx5_glue) / sizeof(void *); ++i) + assert(((const void *const *)mlx5_glue)[i]); + } +#endif mlx5_glue->fork_init(); rte_pci_register(&mlx5_driver); } -- 2.11.0