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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 0EA9AC433C1 for ; Tue, 23 Mar 2021 02:05:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD59A619A5 for ; Tue, 23 Mar 2021 02:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbhCWCEj (ORCPT ); Mon, 22 Mar 2021 22:04:39 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:42030 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbhCWCEN (ORCPT ); Mon, 22 Mar 2021 22:04:13 -0400 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1lOWOi-00CVqE-Ps; Tue, 23 Mar 2021 03:03:56 +0100 Date: Tue, 23 Mar 2021 03:03:56 +0100 From: Andrew Lunn To: Don Bollinger Cc: 'Moshe Shemesh' , "'David S. Miller'" , 'Jakub Kicinski' , 'Adrian Pop' , 'Michal Kubecek' , netdev@vger.kernel.org, 'Vladyslav Tarasiuk' Subject: Re: [RFC PATCH V4 net-next 1/5] ethtool: Allow network drivers to dump arbitrary EEPROM data Message-ID: References: <1616433075-27051-1-git-send-email-moshe@nvidia.com> <1616433075-27051-2-git-send-email-moshe@nvidia.com> <006801d71f47$a61f09b0$f25d1d10$@thebollingers.org> <007b01d71f83$2e0538f0$8a0faad0$@thebollingers.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <007b01d71f83$2e0538f0$8a0faad0$@thebollingers.org> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > > I don't even see a need for this. The offset should be within one 1/2 > page, of > > one bank. So offset >= 0 and <= 127. Length is also > 0 and > > <- 127. And offset+length is <= 127. > > I like the clean approach, but... How do you request low memory? Duh! I got my conditions wrong. Too focused on 1/2 pages to think that two of them makes one page! Lets try again: offset < 256 0 < len < 128 if (offset < 128) offset + len < 128 else offset + len < 256 Does that look better? Reading bytes from the lower 1/2 of page 0 should give the same data as reading data from the lower 1/2 of page 42. So we can allow that, but don't be too surprised when an SFP gets it wrong and gives you rubbish. I would suggest ethtool(1) never actually does read from the lower 1/2 of any page other than 0. And i agree about documentation. I would suggest a comment in ethtool_netlink.h, and the RST documentation. Andrew