From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by dpdk.org (Postfix) with ESMTP id 3E47111A4 for ; Mon, 25 Mar 2019 19:07:47 +0100 (CET) Received: by mail-pl1-f178.google.com with SMTP id g12so317674pll.11 for ; Mon, 25 Mar 2019 11:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wm4d4zJ5NUToK0dn7Bkobi0FlzY5MkGqpiVfqs1MHRY=; b=fvRppjy6NsCig2gmllkLgMR/OuXbKdsY9zGnTab91rFlPY+yCTkk3id+LBGgh22S15 VvoKGEZsSTz6QvLZqcV5RDVrFvqdahV/4lx3EZ5DhgMFq98FC4AITnEWAKuHTTo+Ho9F dAu6xYHAu2e/iL/md8iY7u94bOtPPcX1MHfLd7HSLSdgPZMwErXTq/JC3VeTIrAp8u+6 JogNqtLkRT4G7VryybxqNO/qC9glURXVOYx/nnkeF1DtNcjS+jT/Qu+PnueILAtTAZaP iG0KHp774lTSe8nNnxjOl/veVzcXnven897JhRzsImAwmggWsNyVOBZunwzVDMeS8FEz K6fg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=wm4d4zJ5NUToK0dn7Bkobi0FlzY5MkGqpiVfqs1MHRY=; b=ob6K7bztsG26kSEVsCBF7NZiVygFG9fIP7FAjcBgTsexPoirFtg2KjMieoZVl6U83g 2Rm3c8C7o6d2UxkH0ScOByW+Rfvgoj9THK0p/Cr/NTI6fd8ZGsT/Ckdfr6WbZSwvzvWl pKPwP8KdnrqL9046u/Ozp/s3ThvZ3TBYdlPke50B9VYEQU1zJQtTneGeOfVhnKcrdI56 3nTDOZ5EEvj17zG7C8PA46Bn4QNDLmwivZ4+cEFZ48UIrYyroxE+H7X0k/43glZhpflX 1ObIyIqieGibYu4tVXRXD8us7Ru9iFdYQh3oCCHTEpr6fxbYf0qxc0uCJjrBPmNvKv7Y erDw== X-Gm-Message-State: APjAAAVWsCYLvtFiPaSauRUIH7DahSxeJT7alHGSpz+s9VsfA7Qf+Dc3 so1Hh0UFcfFjLF+bwNSvA5YHcA== X-Google-Smtp-Source: APXvYqxW656SSymitpmN/n5rfHwkDe07t4bU7EKmnHLOGifJwPJBuWzZaV/OYknCJD2yfQm87IAT4g== X-Received: by 2002:a17:902:f20e:: with SMTP id gn14mr26452086plb.334.1553537266441; Mon, 25 Mar 2019 11:07:46 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t22sm22509790pgu.45.2019.03.25.11.07.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2019 11:07:46 -0700 (PDT) Date: Mon, 25 Mar 2019 11:07:43 -0700 From: Stephen Hemminger To: Viacheslav Ovsiienko Cc: dev@dpdk.org, shahafs@mellanox.com Message-ID: <20190325110743.6e98ff03@shemminger-XPS-13-9360> In-Reply-To: <1553533414-9911-2-git-send-email-viacheslavo@mellanox.com> References: <1553155888-27498-1-git-send-email-viacheslavo@mellanox.com> <1553533414-9911-1-git-send-email-viacheslavo@mellanox.com> <1553533414-9911-2-git-send-email-viacheslavo@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 01/13] net/mlx5: add representor recognition on kernels 5.x 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: Mon, 25 Mar 2019 18:07:47 -0000 On Mon, 25 Mar 2019 17:03:22 +0000 Viacheslav Ovsiienko wrote: > + if (switch_id_set) { > + if (info.port_name_new) { > + /* New representors naming schema. */ > + if (port_name_set) { > + info.master = (info.port_name == -1); > + info.representor = (info.port_name != -1); > + } > + } else { > + /* Legacy representors naming schema. */ > + info.master = (!port_name_set || num_vf_set); > + info.representor = port_name_set && !num_vf_set; > + } > + } > + assert(!(data.master && data.representor)); > memcpy(arg, &info, sizeof(info)); > return 0; Since assert() is often removed in non-debug envirionments, why not add a log message and return an error instead? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id CDE61A05D3 for ; Mon, 25 Mar 2019 19:07:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 713D92B9A; Mon, 25 Mar 2019 19:07:49 +0100 (CET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by dpdk.org (Postfix) with ESMTP id 3E47111A4 for ; Mon, 25 Mar 2019 19:07:47 +0100 (CET) Received: by mail-pl1-f178.google.com with SMTP id g12so317674pll.11 for ; Mon, 25 Mar 2019 11:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wm4d4zJ5NUToK0dn7Bkobi0FlzY5MkGqpiVfqs1MHRY=; b=fvRppjy6NsCig2gmllkLgMR/OuXbKdsY9zGnTab91rFlPY+yCTkk3id+LBGgh22S15 VvoKGEZsSTz6QvLZqcV5RDVrFvqdahV/4lx3EZ5DhgMFq98FC4AITnEWAKuHTTo+Ho9F dAu6xYHAu2e/iL/md8iY7u94bOtPPcX1MHfLd7HSLSdgPZMwErXTq/JC3VeTIrAp8u+6 JogNqtLkRT4G7VryybxqNO/qC9glURXVOYx/nnkeF1DtNcjS+jT/Qu+PnueILAtTAZaP iG0KHp774lTSe8nNnxjOl/veVzcXnven897JhRzsImAwmggWsNyVOBZunwzVDMeS8FEz K6fg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=wm4d4zJ5NUToK0dn7Bkobi0FlzY5MkGqpiVfqs1MHRY=; b=ob6K7bztsG26kSEVsCBF7NZiVygFG9fIP7FAjcBgTsexPoirFtg2KjMieoZVl6U83g 2Rm3c8C7o6d2UxkH0ScOByW+Rfvgoj9THK0p/Cr/NTI6fd8ZGsT/Ckdfr6WbZSwvzvWl pKPwP8KdnrqL9046u/Ozp/s3ThvZ3TBYdlPke50B9VYEQU1zJQtTneGeOfVhnKcrdI56 3nTDOZ5EEvj17zG7C8PA46Bn4QNDLmwivZ4+cEFZ48UIrYyroxE+H7X0k/43glZhpflX 1ObIyIqieGibYu4tVXRXD8us7Ru9iFdYQh3oCCHTEpr6fxbYf0qxc0uCJjrBPmNvKv7Y erDw== X-Gm-Message-State: APjAAAVWsCYLvtFiPaSauRUIH7DahSxeJT7alHGSpz+s9VsfA7Qf+Dc3 so1Hh0UFcfFjLF+bwNSvA5YHcA== X-Google-Smtp-Source: APXvYqxW656SSymitpmN/n5rfHwkDe07t4bU7EKmnHLOGifJwPJBuWzZaV/OYknCJD2yfQm87IAT4g== X-Received: by 2002:a17:902:f20e:: with SMTP id gn14mr26452086plb.334.1553537266441; Mon, 25 Mar 2019 11:07:46 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t22sm22509790pgu.45.2019.03.25.11.07.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2019 11:07:46 -0700 (PDT) Date: Mon, 25 Mar 2019 11:07:43 -0700 From: Stephen Hemminger To: Viacheslav Ovsiienko Cc: dev@dpdk.org, shahafs@mellanox.com Message-ID: <20190325110743.6e98ff03@shemminger-XPS-13-9360> In-Reply-To: <1553533414-9911-2-git-send-email-viacheslavo@mellanox.com> References: <1553155888-27498-1-git-send-email-viacheslavo@mellanox.com> <1553533414-9911-1-git-send-email-viacheslavo@mellanox.com> <1553533414-9911-2-git-send-email-viacheslavo@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 01/13] net/mlx5: add representor recognition on kernels 5.x 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190325180743.sPxjfg0ZpdNWeczBtk_j4ubc1y5b9kWsInTdfnM1Cus@z> On Mon, 25 Mar 2019 17:03:22 +0000 Viacheslav Ovsiienko wrote: > + if (switch_id_set) { > + if (info.port_name_new) { > + /* New representors naming schema. */ > + if (port_name_set) { > + info.master = (info.port_name == -1); > + info.representor = (info.port_name != -1); > + } > + } else { > + /* Legacy representors naming schema. */ > + info.master = (!port_name_set || num_vf_set); > + info.representor = port_name_set && !num_vf_set; > + } > + } > + assert(!(data.master && data.representor)); > memcpy(arg, &info, sizeof(info)); > return 0; Since assert() is often removed in non-debug envirionments, why not add a log message and return an error instead?