From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EBC8E42F9A; Tue, 1 Aug 2023 17:25:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D895D40F16; Tue, 1 Aug 2023 17:25:58 +0200 (CEST) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id B36D340A89 for ; Tue, 1 Aug 2023 17:25:57 +0200 (CEST) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1b8b2b60731so34263945ad.2 for ; Tue, 01 Aug 2023 08:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1690903557; x=1691508357; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=YFyiaNMvviyQGfxPCdpyVTgV4JAXmZ1qOv0M4CCLkD0=; b=CWtSZdgiJdFpsmumzv+a+Z5nnGmwXeOVvOZ4UN5VgDOqPiM5rm48rAoTF0fRDaCIYQ 6cgL6rRMz01hObuj0ItuUMDDyOcxT0QRdd291viKKpXfBc+OIUki2TGC6rd75VZn1ruc /X4FFRhLqsZAiUTY+4RL4ZYlgruz7xbApmVjbW3RgmEHtULQmNXno4dFE4Lf+hOwzrTz jxsEhVg1w1A3behTjuk70Oiwe3IRejk06xYHGUWyGX8eQBvwHr0iO+JyqRkPwKVnbxcn GgOFd68eywjdjDq7Hvr4sa3TxzM8ZiDVGwFky/TQlFmvxb52Z0bXIXe7rsMzxF9sa6+N 902Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690903557; x=1691508357; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YFyiaNMvviyQGfxPCdpyVTgV4JAXmZ1qOv0M4CCLkD0=; b=QqwMcv+h/UNnNJDnp8jCdEd1IQFz++8eLedY19PgPvRTSuXruXI3pvEj6MJepbVaiY 9EOj/VZMFlpJn1Mq4dGmlr6POCPurU/LktFc9wAerzYZdIcCuadnfI08oNfKwuToDOB0 +nXWEx0dOsPk+r9AEWISnBS1yrh9BBpqLAtYTTHibSEvrrHIG3/PC7Wa321rVW2XPU/2 NuCLkhw0On8vKzM5FiYgWdPMsr6+b5tyGSD0NkD8XsOhjixnZPMN84P+r4gykYU5BcWX WhY9RYARn3huzrd3fFtHkrcAgUpsdP6+v396jNcD9H3aDrAjnO48sl77uo/MDAuKnu2j amJA== X-Gm-Message-State: ABy/qLZkwb9kx0pxi/R33aibgEj80wpEMbwOjdPFqQJOnAtSbUexaJB+ U7kbFssGT25x24rViidA3CErqw== X-Google-Smtp-Source: APBJJlG3jr5H4dCD0uut2KS/J2WiHhfud6r2goNKdIABgs+AGYSxLM7vJ69u2yhz3npg4sZzPHKVQg== X-Received: by 2002:a17:903:230b:b0:1b2:1b22:196 with SMTP id d11-20020a170903230b00b001b21b220196mr13784698plh.48.1690903556827; Tue, 01 Aug 2023 08:25:56 -0700 (PDT) Received: from hermes.local (204-195-127-207.wavecable.com. [204.195.127.207]) by smtp.gmail.com with ESMTPSA id i5-20020a170902eb4500b001ae0a4b1d3fsm10629589pli.153.2023.08.01.08.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 08:25:56 -0700 (PDT) Date: Tue, 1 Aug 2023 08:25:55 -0700 From: Stephen Hemminger To: Wenbo Cao Cc: dev@dpdk.org Subject: Re: [[PATCH v1] 4/8] net/rnp: add mbx basic api feature Message-ID: <20230801082555.36dd9f80@hermes.local> In-Reply-To: <20230801072207.836932-1-caowenbo@mucse.com> References: <20230801072207.836932-1-caowenbo@mucse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, 1 Aug 2023 07:22:07 +0000 Wenbo Cao wrote: > +struct rnp_mbx_api { > + void (*init_mbx)(struct rnp_hw *hw); > + int32_t (*read)(struct rnp_hw *hw, > + uint32_t *msg, > + uint16_t size, > + enum MBX_ID); > + int32_t (*write)(struct rnp_hw *hw, > + uint32_t *msg, > + uint16_t size, > + enum MBX_ID); > + int32_t (*read_posted)(struct rte_eth_dev *dev, > + uint32_t *msg, > + uint16_t size, > + enum MBX_ID); > + int32_t (*write_posted)(struct rte_eth_dev *dev, > + uint32_t *msg, > + uint16_t size, > + enum MBX_ID); > + int32_t (*check_for_msg)(struct rnp_hw *hw, enum MBX_ID); > + int32_t (*check_for_ack)(struct rnp_hw *hw, enum MBX_ID); > + int32_t (*check_for_rst)(struct rnp_hw *hw, enum MBX_ID); > + int32_t (*configure)(struct rnp_hw *hw, int nr_vec, bool enable); > +}; Since this data structure only has virtual function pointers; many types of bugs can be avoided if it can be made const. If it const, then compiler can put the initialized table in r/o text section.