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=-0.8 required=3.0 tests=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 1EBAFC83004 for ; Tue, 28 Apr 2020 22:30:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0111120731 for ; Tue, 28 Apr 2020 22:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726361AbgD1WaE (ORCPT ); Tue, 28 Apr 2020 18:30:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:57104 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbgD1WaE (ORCPT ); Tue, 28 Apr 2020 18:30:04 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1A777ACAB; Tue, 28 Apr 2020 22:30:02 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id AF873E128C; Wed, 29 Apr 2020 00:30:00 +0200 (CEST) Message-Id: From: Michal Kubecek Subject: [PATCH ethtool 0/2] improve the logic of fallback from netlink to ioctl To: John Linville , netdev@vger.kernel.org Cc: Andrew Lunn Date: Wed, 29 Apr 2020 00:30:00 +0200 (CEST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org At the moment, ethtool falls back to ioctl implementation whenever either in response to request type not implemented in kernel or netlink interface is unavailable or netlink request fails with EOPNOTSUPP error code. This is not perfect as EOPNOTSUPP can have different meanings and we only want to fall back if it is caused by kernel lacking netlink implementation of the request. In other cases, we would needlessly repeat the same failure trying both netlink and ioctl. These two patches improve the logic to avoid such duplicate failures and improve handling of cases where fallback to ioctl is impossible for other reasons (e.g. wildcard device name or no ioctl handler). Michal Kubecek (2): refactor interface between ioctl and netlink code netlink: use genetlink ops information to decide about fallback ethtool.c | 51 +++--------- netlink/extapi.h | 14 ++-- netlink/monitor.c | 15 +++- netlink/netlink.c | 193 ++++++++++++++++++++++++++++++++++++++------- netlink/netlink.h | 6 ++ netlink/parser.c | 7 ++ netlink/settings.c | 7 ++ 7 files changed, 220 insertions(+), 73 deletions(-) -- 2.26.2