From patchwork Sat Oct 9 18:45:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 12547959 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A38CC433FE for ; Sat, 9 Oct 2021 18:45:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2FA7960F90 for ; Sat, 9 Oct 2021 18:45:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229763AbhJISrb (ORCPT ); Sat, 9 Oct 2021 14:47:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbhJISr3 (ORCPT ); Sat, 9 Oct 2021 14:47:29 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A764FC061570 for ; Sat, 9 Oct 2021 11:45:32 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id v20so1270963plo.7 for ; Sat, 09 Oct 2021 11:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n2xJeonrNzJwNbk39d1vJZZUu+mYZbA/KdBQyG7UKOk=; b=Whf8ylRK5mdJPakk1l6tEs9lT7rZHZU5z48N//luFzfH8o8Wzmd52UpAgclRKnlVwK ydVa6kmbkrwV7sEkOl/V8hw1hj2RjfBWGgPQGWa0nsh7natXL5oRQjwChFN1OhA2QFo7 319d3MR7Na4qKCssc0RH1khrcBb+hrrnGcou1G26gLMMe9ES1hF/C/5Yvi9zfFCk2v2e eH+YvunxOdA1eKhm/zE+o4wuk8bp3FAGEt9Bkuqgub3PsS0NRn9+Z7fIdVbCBA6QIq2Q c9rGv3huZ4l1VOqjIZ9lwkEi0lk/6huWAiHVqFeBZZqXiQ9MwC8riX0lnAkakwMQZlSw 3Rdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n2xJeonrNzJwNbk39d1vJZZUu+mYZbA/KdBQyG7UKOk=; b=48pIuXXE6SIA8+o/F9yfl1G2NGSGJcLHRHhmDvxoZb8qrJVBKSOhTlgFMaeLOt/OO6 NXc1a5QKmSVIEaloR5I/joEc2mCanVepz1kU1jHvu1v8AqakDaINHWkMmgRX+gCOUal8 ytsJM9Jf2O9+x3dZvyVs5Ep5lTn19cXYxtjLtYzrCOQKx/yiw3Fl1o//ssAyWvGhVzzY tqZ0RAUTZJbewbXgugzcd5tD69f/kW/Vqgzt2sKOwtBjN9DBAyMarbnarvFnGdj6qIGx nn907zU/HfzLMx2qAnj+qjNJW3OmzhLJuS0Iq0/vsJ4o9nPoJ+NtYsUKCaRnRXaP1WdW E5Aw== X-Gm-Message-State: AOAM532gdUv0k5dFIOcJwVvFzdoB2jf6vpT3RKLUESgIg5xXej+pN53f VEaW0Y9aqJ47u7nd5o1osi9VIg== X-Google-Smtp-Source: ABdhPJxsokeslVhnKPXXtTKH+imZPwIY8POVv54UfYbh3bLUyUR5pax4w9XdlX0Ak+KM8vn2bHvhiA== X-Received: by 2002:a17:90b:1106:: with SMTP id gi6mr20095350pjb.144.1633805132224; Sat, 09 Oct 2021 11:45:32 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id s30sm3368433pgo.39.2021.10.09.11.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 11:45:31 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, jtoppins@redhat.com, Shannon Nelson Subject: [PATCH net-next 1/9] ionic: add filterlist to debugfs Date: Sat, 9 Oct 2021 11:45:15 -0700 Message-Id: <20211009184523.73154-2-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211009184523.73154-1-snelson@pensando.io> References: <20211009184523.73154-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Dump the filter list to debugfs - includes the device-assigned filter id and the sync'd-to-hardware status. Signed-off-by: Shannon Nelson --- .../ethernet/pensando/ionic/ionic_debugfs.c | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c index 86b79430c2ad..c58217027564 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_debugfs.c @@ -226,6 +226,50 @@ static int netdev_show(struct seq_file *seq, void *v) } DEFINE_SHOW_ATTRIBUTE(netdev); +static int lif_filters_show(struct seq_file *seq, void *v) +{ + struct ionic_lif *lif = seq->private; + struct ionic_rx_filter *f; + struct hlist_head *head; + struct hlist_node *tmp; + unsigned int i; + + seq_puts(seq, "id flow state type filter\n"); + spin_lock_bh(&lif->rx_filters.lock); + for (i = 0; i < IONIC_RX_FILTER_HLISTS; i++) { + head = &lif->rx_filters.by_id[i]; + hlist_for_each_entry_safe(f, tmp, head, by_id) { + switch (le16_to_cpu(f->cmd.match)) { + case IONIC_RX_FILTER_MATCH_VLAN: + seq_printf(seq, "0x%04x 0x%08x 0x%02x vlan 0x%04x\n", + f->filter_id, f->flow_id, f->state, + le16_to_cpu(f->cmd.vlan.vlan)); + break; + case IONIC_RX_FILTER_MATCH_MAC: + seq_printf(seq, "0x%04x 0x%08x 0x%02x mac %pM\n", + f->filter_id, f->flow_id, f->state, + f->cmd.mac.addr); + break; + case IONIC_RX_FILTER_MATCH_MAC_VLAN: + seq_printf(seq, "0x%04x 0x%08x 0x%02x macvl 0x%04x %pM\n", + f->filter_id, f->flow_id, f->state, + le16_to_cpu(f->cmd.vlan.vlan), + f->cmd.mac.addr); + break; + case IONIC_RX_FILTER_STEER_PKTCLASS: + seq_printf(seq, "0x%04x 0x%08x 0x%02x rxstr 0x%llx\n", + f->filter_id, f->flow_id, f->state, + le64_to_cpu(f->cmd.pkt_class)); + break; + } + } + } + spin_unlock_bh(&lif->rx_filters.lock); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(lif_filters); + void ionic_debugfs_add_lif(struct ionic_lif *lif) { struct dentry *lif_dentry; @@ -237,6 +281,8 @@ void ionic_debugfs_add_lif(struct ionic_lif *lif) debugfs_create_file("netdev", 0400, lif->dentry, lif->netdev, &netdev_fops); + debugfs_create_file("filters", 0400, lif->dentry, + lif, &lif_filters_fops); } void ionic_debugfs_del_lif(struct ionic_lif *lif) From patchwork Sat Oct 9 18:45:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 12547961 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57D57C433EF for ; Sat, 9 Oct 2021 18:45:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C88A61041 for ; Sat, 9 Oct 2021 18:45:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbhJISrd (ORCPT ); Sat, 9 Oct 2021 14:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229558AbhJISrb (ORCPT ); Sat, 9 Oct 2021 14:47:31 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD6AFC061570 for ; Sat, 9 Oct 2021 11:45:33 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id np13so10024912pjb.4 for ; Sat, 09 Oct 2021 11:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dLUYf3IO+geaxiyWZv7krbcqOQ6TyS6gJ1exzgQUyns=; b=MhGZlbQicjXqnyBPEIJ52Ol0Jwzj/shW8jJnDWe3/nrErBSQySoO+MPh6OSRDq7Cma BgP+T5ebhl4QICMrtArPMa64XNdpP8mnJ3Oroxs9O91hXHMD+AB2pBylPO6BAO/BWF5j +YOV1nsI7kIe0s27XptEHLOIEfGj/GSwAs3W8FG7xca/SsQoaMK0u6i1lZPkQmOMJTrt nmicZ+lNlS3x7oaFPCF8tCrZC8btJtffw1AWYTLqISfXvzygSX1HtmbbIj0P7Hawc/iz w8QUzWEgH/JYd9eybjVwkSnzMMHhTS8Vx2bHJQztQwCeNI5Zyh0miQhXXXftVmbndsk9 khjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dLUYf3IO+geaxiyWZv7krbcqOQ6TyS6gJ1exzgQUyns=; b=PxDwzwsffCKQ7pgNDNr2qEj7mTujrHZJvSijCtJAVQGvlcrrif0pAWpCtdhZhg+uZm 9uzSnzW4fVDl+Hf515bsTLI/VSXgJNh/FYSys+nPJ+W9EQmColcFePzGLBPNB21sX+Jz +F/c2G4DmujZNHpNS5Mb0906ucGd/hGsItyZIWY2eN1Db7BbUhSUJcDQ95RlJStc3epw zGZjPzguNIQ2YXvvTygaHge4EpFm86b3JsoC4HZqKD4/bFOKBNJn7DjWsaAKSc8edtkG N8G29wDxGozmLlLjYj3idkX5W6tNiOo2dUIUkp7PeupzE6nNAsu5iocTdBnfSc/BxbUY OU6A== X-Gm-Message-State: AOAM532GZUg60Nfix6+wfl2712g1JelZHDh6Fozpts15MkFcwFaYu42b +AEy3jj4UesxWk5/5wCXQ2ehyg== X-Google-Smtp-Source: ABdhPJyrN+5VchvwaIaWFRg/uvc3oZelss/VTO/UvxmqcN2mBOdSg2y1rwBfvURgq34IYsvhfFKDbA== X-Received: by 2002:a17:90a:9404:: with SMTP id r4mr19568166pjo.240.1633805133433; Sat, 09 Oct 2021 11:45:33 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id s30sm3368433pgo.39.2021.10.09.11.45.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 11:45:33 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, jtoppins@redhat.com, Shannon Nelson Subject: [PATCH net-next 2/9] ionic: move lif mac address functions Date: Sat, 9 Oct 2021 11:45:16 -0700 Message-Id: <20211009184523.73154-3-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211009184523.73154-1-snelson@pensando.io> References: <20211009184523.73154-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The routines that add and delete mac addresses from the firmware really should be in the file with the rest of the filter management. This simply moves the functions with no logic changes. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 131 ------------------ .../ethernet/pensando/ionic/ionic_rx_filter.c | 131 ++++++++++++++++++ 2 files changed, 131 insertions(+), 131 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 775ce83a1b28..968403a01477 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1242,137 +1242,6 @@ void ionic_get_stats64(struct net_device *netdev, ns->tx_errors = ns->tx_aborted_errors; } -int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) -{ - struct ionic_admin_ctx ctx = { - .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), - .cmd.rx_filter_add = { - .opcode = IONIC_CMD_RX_FILTER_ADD, - .lif_index = cpu_to_le16(lif->index), - .match = cpu_to_le16(IONIC_RX_FILTER_MATCH_MAC), - }, - }; - int nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); - bool mc = is_multicast_ether_addr(addr); - struct ionic_rx_filter *f; - int err = 0; - - memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN); - - spin_lock_bh(&lif->rx_filters.lock); - f = ionic_rx_filter_by_addr(lif, addr); - if (f) { - /* don't bother if we already have it and it is sync'd */ - if (f->state == IONIC_FILTER_STATE_SYNCED) { - spin_unlock_bh(&lif->rx_filters.lock); - return 0; - } - - /* mark preemptively as sync'd to block any parallel attempts */ - f->state = IONIC_FILTER_STATE_SYNCED; - } else { - /* save as SYNCED to catch any DEL requests while processing */ - err = ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx, - IONIC_FILTER_STATE_SYNCED); - } - spin_unlock_bh(&lif->rx_filters.lock); - if (err) - return err; - - netdev_dbg(lif->netdev, "rx_filter add ADDR %pM\n", addr); - - /* Don't bother with the write to FW if we know there's no room, - * we can try again on the next sync attempt. - */ - if ((lif->nucast + lif->nmcast) >= nfilters) - err = -ENOSPC; - else - err = ionic_adminq_post_wait(lif, &ctx); - - spin_lock_bh(&lif->rx_filters.lock); - if (err && err != -EEXIST) { - /* set the state back to NEW so we can try again later */ - f = ionic_rx_filter_by_addr(lif, addr); - if (f && f->state == IONIC_FILTER_STATE_SYNCED) { - f->state = IONIC_FILTER_STATE_NEW; - set_bit(IONIC_LIF_F_FILTER_SYNC_NEEDED, lif->state); - } - - spin_unlock_bh(&lif->rx_filters.lock); - - if (err == -ENOSPC) - return 0; - else - return err; - } - - if (mc) - lif->nmcast++; - else - lif->nucast++; - - f = ionic_rx_filter_by_addr(lif, addr); - if (f && f->state == IONIC_FILTER_STATE_OLD) { - /* Someone requested a delete while we were adding - * so update the filter info with the results from the add - * and the data will be there for the delete on the next - * sync cycle. - */ - err = ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx, - IONIC_FILTER_STATE_OLD); - } else { - err = ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx, - IONIC_FILTER_STATE_SYNCED); - } - - spin_unlock_bh(&lif->rx_filters.lock); - - return err; -} - -int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) -{ - struct ionic_admin_ctx ctx = { - .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), - .cmd.rx_filter_del = { - .opcode = IONIC_CMD_RX_FILTER_DEL, - .lif_index = cpu_to_le16(lif->index), - }, - }; - struct ionic_rx_filter *f; - int state; - int err; - - spin_lock_bh(&lif->rx_filters.lock); - f = ionic_rx_filter_by_addr(lif, addr); - if (!f) { - spin_unlock_bh(&lif->rx_filters.lock); - return -ENOENT; - } - - netdev_dbg(lif->netdev, "rx_filter del ADDR %pM (id %d)\n", - addr, f->filter_id); - - state = f->state; - ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id); - ionic_rx_filter_free(lif, f); - - if (is_multicast_ether_addr(addr) && lif->nmcast) - lif->nmcast--; - else if (!is_multicast_ether_addr(addr) && lif->nucast) - lif->nucast--; - - spin_unlock_bh(&lif->rx_filters.lock); - - if (state != IONIC_FILTER_STATE_NEW) { - err = ionic_adminq_post_wait(lif, &ctx); - if (err && err != -EEXIST) - return err; - } - - return 0; -} - static int ionic_addr_add(struct net_device *netdev, const u8 *addr) { return ionic_lif_list_addr(netdev_priv(netdev), addr, ADD_ADDR); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c index 69728f9013cb..19115d966693 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c @@ -286,6 +286,137 @@ int ionic_lif_list_addr(struct ionic_lif *lif, const u8 *addr, bool mode) return 0; } +int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) +{ + struct ionic_admin_ctx ctx = { + .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), + .cmd.rx_filter_add = { + .opcode = IONIC_CMD_RX_FILTER_ADD, + .lif_index = cpu_to_le16(lif->index), + .match = cpu_to_le16(IONIC_RX_FILTER_MATCH_MAC), + }, + }; + int nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); + bool mc = is_multicast_ether_addr(addr); + struct ionic_rx_filter *f; + int err = 0; + + memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN); + + spin_lock_bh(&lif->rx_filters.lock); + f = ionic_rx_filter_by_addr(lif, addr); + if (f) { + /* don't bother if we already have it and it is sync'd */ + if (f->state == IONIC_FILTER_STATE_SYNCED) { + spin_unlock_bh(&lif->rx_filters.lock); + return 0; + } + + /* mark preemptively as sync'd to block any parallel attempts */ + f->state = IONIC_FILTER_STATE_SYNCED; + } else { + /* save as SYNCED to catch any DEL requests while processing */ + err = ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx, + IONIC_FILTER_STATE_SYNCED); + } + spin_unlock_bh(&lif->rx_filters.lock); + if (err) + return err; + + netdev_dbg(lif->netdev, "rx_filter add ADDR %pM\n", addr); + + /* Don't bother with the write to FW if we know there's no room, + * we can try again on the next sync attempt. + */ + if ((lif->nucast + lif->nmcast) >= nfilters) + err = -ENOSPC; + else + err = ionic_adminq_post_wait(lif, &ctx); + + spin_lock_bh(&lif->rx_filters.lock); + if (err && err != -EEXIST) { + /* set the state back to NEW so we can try again later */ + f = ionic_rx_filter_by_addr(lif, addr); + if (f && f->state == IONIC_FILTER_STATE_SYNCED) { + f->state = IONIC_FILTER_STATE_NEW; + set_bit(IONIC_LIF_F_FILTER_SYNC_NEEDED, lif->state); + } + + spin_unlock_bh(&lif->rx_filters.lock); + + if (err == -ENOSPC) + return 0; + else + return err; + } + + if (mc) + lif->nmcast++; + else + lif->nucast++; + + f = ionic_rx_filter_by_addr(lif, addr); + if (f && f->state == IONIC_FILTER_STATE_OLD) { + /* Someone requested a delete while we were adding + * so update the filter info with the results from the add + * and the data will be there for the delete on the next + * sync cycle. + */ + err = ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx, + IONIC_FILTER_STATE_OLD); + } else { + err = ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx, + IONIC_FILTER_STATE_SYNCED); + } + + spin_unlock_bh(&lif->rx_filters.lock); + + return err; +} + +int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) +{ + struct ionic_admin_ctx ctx = { + .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), + .cmd.rx_filter_del = { + .opcode = IONIC_CMD_RX_FILTER_DEL, + .lif_index = cpu_to_le16(lif->index), + }, + }; + struct ionic_rx_filter *f; + int state; + int err; + + spin_lock_bh(&lif->rx_filters.lock); + f = ionic_rx_filter_by_addr(lif, addr); + if (!f) { + spin_unlock_bh(&lif->rx_filters.lock); + return -ENOENT; + } + + netdev_dbg(lif->netdev, "rx_filter del ADDR %pM (id %d)\n", + addr, f->filter_id); + + state = f->state; + ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id); + ionic_rx_filter_free(lif, f); + + if (is_multicast_ether_addr(addr) && lif->nmcast) + lif->nmcast--; + else if (!is_multicast_ether_addr(addr) && lif->nucast) + lif->nucast--; + + spin_unlock_bh(&lif->rx_filters.lock); + + if (state != IONIC_FILTER_STATE_NEW) { + err = ionic_adminq_post_wait(lif, &ctx); + if (err && err != -EEXIST) + return err; + } + + return 0; +} + struct sync_item { struct list_head list; struct ionic_rx_filter f; From patchwork Sat Oct 9 18:45:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 12547965 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77BC1C433F5 for ; Sat, 9 Oct 2021 18:45:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5566C60F9C for ; Sat, 9 Oct 2021 18:45:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229878AbhJISrf (ORCPT ); Sat, 9 Oct 2021 14:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbhJISrb (ORCPT ); Sat, 9 Oct 2021 14:47:31 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D170DC061762 for ; Sat, 9 Oct 2021 11:45:34 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id ls18so10032937pjb.3 for ; Sat, 09 Oct 2021 11:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7yqKDBx+BYgoTha9tb+h3Ene4dSXgout69kiKn+t0tw=; b=L/bp33Z04/KS0KPjSPlXdLMPwSp98zHFP94/SsVsR7s/FBdoBKQT/Oj3ATxebLmLGk 0/gJ/adgIMoDph7ZkDnB/6sSKHVdPLaTKDVnePstR+sVP2MZXUVphIW42aZH0/A9fog+ IzqRK3Sg5beL3zTTAi/Mir4kgVswW26NTbZ5dHmG5cyzMlckBm6NatZwbLvuSA3YXJnI mhtEyfDq1uwmIKYSlc5+nnRjogo8zDK6MiLy69yE3QeizKJkGp/fDXmBZa4ZhEOimXeb 7XdnxmxsfSQGu1eIaamyoXa1xXRbFIMGSexcu+hmuL9LpqMso8E3ja36u3npNO0E9Jmt np/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7yqKDBx+BYgoTha9tb+h3Ene4dSXgout69kiKn+t0tw=; b=E1kMqyUQBQ0f1NpJDR5gZFcvbBfyGCaXaqyO0ns5GaU/d64N6PsfyHxInIe8Ci1f+f dza024isshhD8qkkL7aCQWHBDtzeOigetQQ+DlL4oUS6gpMQwyaOuBkSyP2Lwho2pchY S8KNVKsK18NS+X8iHvdp+oCis0yPXBc18/W6zw5AME7qZ/VsnGpIJOE2nt8gSBM0JbFa aVXOCfI5YwLiXpMackos29thpRBdEBWsgjJQbg8q4yRW1vzc/XMRSeXsyZ/yM8at211b 6Y9CrZFtsPmeqH3Z+ZC/m8YB4IoJzgh3r2aKTdyeN/YxXb6OYkV/8xb/fQ3aeH29M2OW 2uIw== X-Gm-Message-State: AOAM532KoDXUUd/Q/NNdtFnQ2d3nUNL4kBp5Ew++4/jXKJAiAH5s8oY9 tmGWgydhVVBI6ZMHixMJFp5BoQ== X-Google-Smtp-Source: ABdhPJz//w4BLF7092fC295xKiu/DLalmQfo6djewaf7iQZtC5jjMsBq/xFgrr8CKLDhBdy6RwBhWA== X-Received: by 2002:a17:90a:430e:: with SMTP id q14mr20085029pjg.55.1633805134387; Sat, 09 Oct 2021 11:45:34 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id s30sm3368433pgo.39.2021.10.09.11.45.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 11:45:34 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, jtoppins@redhat.com, Shannon Nelson Subject: [PATCH net-next 3/9] ionic: remove mac overflow flags Date: Sat, 9 Oct 2021 11:45:17 -0700 Message-Id: <20211009184523.73154-4-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211009184523.73154-1-snelson@pensando.io> References: <20211009184523.73154-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The overflow flags really aren't useful and we don't need lif struct elements to track them. Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 7 ++----- drivers/net/ethernet/pensando/ionic/ionic_lif.h | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 968403a01477..4a080612142a 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1283,14 +1283,11 @@ void ionic_lif_rx_mode(struct ionic_lif *lif) * to see if we can disable NIC PROMISC */ nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); + if ((lif->nucast + lif->nmcast) >= nfilters) { rx_mode |= IONIC_RX_MODE_F_PROMISC; rx_mode |= IONIC_RX_MODE_F_ALLMULTI; - lif->uc_overflow = true; - lif->mc_overflow = true; - } else if (lif->uc_overflow) { - lif->uc_overflow = false; - lif->mc_overflow = false; + } else { if (!(nd_flags & IFF_PROMISC)) rx_mode &= ~IONIC_RX_MODE_F_PROMISC; if (!(nd_flags & IFF_ALLMULTI)) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index 41f28154745f..541aa54e4ffd 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -189,8 +189,6 @@ struct ionic_lif { u16 rx_mode; u64 hw_features; bool registered; - bool mc_overflow; - bool uc_overflow; u16 lif_type; unsigned int nmcast; unsigned int nucast; From patchwork Sat Oct 9 18:45:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 12547963 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AA2EC4332F for ; Sat, 9 Oct 2021 18:45:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC87960F90 for ; Sat, 9 Oct 2021 18:45:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbhJISrh (ORCPT ); Sat, 9 Oct 2021 14:47:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbhJISrd (ORCPT ); Sat, 9 Oct 2021 14:47:33 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5B4DC061764 for ; Sat, 9 Oct 2021 11:45:35 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id y1so8327575plk.10 for ; Sat, 09 Oct 2021 11:45:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cqG8ukWqJUov6G2GTF8lSeTYl/ObEE6+pcLhvhm1K7o=; b=R0Mh/pjUyXF04Ch85eyyglJUmRJ4dBWY/cuiL9zzl/5Q2LRuRIW5C2FROyjw8gj9u4 R/YrzCfzGAjLvv1pmSevGZWXOSZ/71YPg3eNr/rQiqQEHlMbi4YSBrUjxlgN2eVbt+Yk gyG/MGoHwMiNmWeoknoAqPF7eyCh8T2hlyk0lfOjoagpcareHPbWOTi8qOAR0wadWeU3 P6cX1suY0t2D4/yZSnRQk7CARMsx3MbnCwJx/Y+yVqGcTE/I2t7aWHzfOmxTMc9xZ30E E3RcJ+Qky9RaPdLKjvd2xqZn+zseD3BGWm/jB/9pZsscDzN3AC0FVXAqqssYOVmc69Sg w4Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cqG8ukWqJUov6G2GTF8lSeTYl/ObEE6+pcLhvhm1K7o=; b=FdDlOb7cUFISzpLnIfgCRXQyGVlWl52dbggeXHrHMN/p4PUhxzkTn6H1sz9wdH7WVm I1V9/zSFs+T4qh5Y5QnFJ7eAWZM9LZl1KEcXxtu3bqzWM8zuK3J16GxFPGcrWgas7Ny7 BRfUCeIJ/a3nEfne9kWHPmJ8hG9CPqB0bBLg5teOjz41PybR8Tno4dfVL/jULk2uv6g9 4Y3+mJWkzbkS07+vFu96BtdfAEicl9vEzcw2K6Z+pQ0QHGuBvRBZP8Pz1Xrmpltp709j ejj9EkIBAk6x7aOk22VDXVtNon9O1viGxmSLPbEv6pJ9Dkxno3cNLMvcloctBKQ75JtL MP5Q== X-Gm-Message-State: AOAM5328TsGlM2Cko2OTFLGW1cq1oGd6Ti48ch8a75+o0ILBP0JzC6MM dGnGZNN5VA4+2H/NSWRcqW9beg== X-Google-Smtp-Source: ABdhPJykCabopHXQZN3q0cCSAAK6QGBbDYSM3H8BkSjfqZ5SWnVMSvqI0aToUh2prJdpSg9P/7dAbA== X-Received: by 2002:a17:90a:9b84:: with SMTP id g4mr17820856pjp.123.1633805135358; Sat, 09 Oct 2021 11:45:35 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id s30sm3368433pgo.39.2021.10.09.11.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 11:45:35 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, jtoppins@redhat.com, Shannon Nelson Subject: [PATCH net-next 4/9] ionic: add generic filter search Date: Sat, 9 Oct 2021 11:45:18 -0700 Message-Id: <20211009184523.73154-5-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211009184523.73154-1-snelson@pensando.io> References: <20211009184523.73154-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In preparation for enhancing vlan filter management, add a filter search routine that can figure out for itself which type of filter search is needed. Signed-off-by: Shannon Nelson --- .../ethernet/pensando/ionic/ionic_rx_filter.c | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c index 19115d966693..38109244a722 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c @@ -239,6 +239,21 @@ struct ionic_rx_filter *ionic_rx_filter_rxsteer(struct ionic_lif *lif) return NULL; } +static struct ionic_rx_filter *ionic_rx_filter_find(struct ionic_lif *lif, + struct ionic_rx_filter_add_cmd *ac) +{ + switch (le16_to_cpu(ac->match)) { + case IONIC_RX_FILTER_MATCH_VLAN: + return ionic_rx_filter_by_vlan(lif, le16_to_cpu(ac->vlan.vlan)); + case IONIC_RX_FILTER_MATCH_MAC: + return ionic_rx_filter_by_addr(lif, ac->mac.addr); + default: + netdev_err(lif->netdev, "unsupported filter match %d", + le16_to_cpu(ac->match)); + return NULL; + } +} + int ionic_lif_list_addr(struct ionic_lif *lif, const u8 *addr, bool mode) { struct ionic_rx_filter *f; @@ -304,7 +319,7 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN); spin_lock_bh(&lif->rx_filters.lock); - f = ionic_rx_filter_by_addr(lif, addr); + f = ionic_rx_filter_find(lif, &ctx.cmd.rx_filter_add); if (f) { /* don't bother if we already have it and it is sync'd */ if (f->state == IONIC_FILTER_STATE_SYNCED) { @@ -336,7 +351,7 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) spin_lock_bh(&lif->rx_filters.lock); if (err && err != -EEXIST) { /* set the state back to NEW so we can try again later */ - f = ionic_rx_filter_by_addr(lif, addr); + f = ionic_rx_filter_find(lif, &ctx.cmd.rx_filter_add); if (f && f->state == IONIC_FILTER_STATE_SYNCED) { f->state = IONIC_FILTER_STATE_NEW; set_bit(IONIC_LIF_F_FILTER_SYNC_NEEDED, lif->state); @@ -355,7 +370,7 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) else lif->nucast++; - f = ionic_rx_filter_by_addr(lif, addr); + f = ionic_rx_filter_find(lif, &ctx.cmd.rx_filter_add); if (f && f->state == IONIC_FILTER_STATE_OLD) { /* Someone requested a delete while we were adding * so update the filter info with the results from the add From patchwork Sat Oct 9 18:45:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 12547967 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A4E8C433FE for ; Sat, 9 Oct 2021 18:45:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1A9AB60F6B for ; Sat, 9 Oct 2021 18:45:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbhJISri (ORCPT ); Sat, 9 Oct 2021 14:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbhJISrd (ORCPT ); Sat, 9 Oct 2021 14:47:33 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2FF6C061570 for ; Sat, 9 Oct 2021 11:45:36 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id a11so8415864plm.0 for ; Sat, 09 Oct 2021 11:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y32UIRGWq/fDw9IngSgbVO50yJkl01SHF3LsQZzy4EA=; b=hlc6Qb4bxCK/hW6BTDfTdQPZyZmVbPieyWxZslt1447iVqCQkwRavbA2eHfGAb3mZW cNpaXAOq4jsU+B6zW19aAM83HU9kDWPscHwnOqWoBT6w4Y75twLCJ4B1VCdaq4QXvQgG xe0g3t18gBEyEHiXZpi9c5pLh2QRtqNMOsMpJvELI/tBbzPbYg5juFcsz1am0stAXuXd 0835/kQPhcBj5gVBSIKxmXnv3K+CzCV8GANjMlxpg5cAnuP3R9oTiLA6fsU0AlI4o5tg slB6faowlFt0FZb3AMjXPJ2Qs4rgE9z0pfyprx9P22t+JbuDLkwFRZbMAstrY0RuKGKS utbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y32UIRGWq/fDw9IngSgbVO50yJkl01SHF3LsQZzy4EA=; b=47yPhn3NKNBW9UAQeX34inCj+7Erx2mS6DVjIEKf58BGetdKVgyfHafnLvDlxsHqNE s1ZEBtNo2UxySA4BRgKVKTacwNSerIswXivb4iTiFBr/nC3FZa4/FQuATd3RfwCR7WTK J0fU80knyVmq6e0PjVVV4NEjTcq//C2csilNkI/z1gi3KAji6QbYD9dbMR2aFxMCujPg 5mtxmjJ0yZNYhYaMPPhL60FMhmprjLdSw3Upr3C4h0qf38U2YnVon8gx3rhUf76tzQcS FRjx/iTIyyVnc8jctiiZ1gE2QjOJzkZna9QSdBGcl/RrB3VRTWNG0BN23VQ9RGauHkqp 36gw== X-Gm-Message-State: AOAM531yq8PhpIu3YchZa28WQ03Bxc5X+TnNQlgNOlPu/Wp2TE7/3r5l FCeICa8/03NkJA7JLKR2U3H6IA== X-Google-Smtp-Source: ABdhPJxURjUN9vbUzuD/LxANPiCJ9SPofCm8Q1TsN66Y+xDjbpVzDUCpf1w7PfwKtmVGidsbvK0Opg== X-Received: by 2002:a17:90a:1507:: with SMTP id l7mr19518371pja.141.1633805136275; Sat, 09 Oct 2021 11:45:36 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id s30sm3368433pgo.39.2021.10.09.11.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 11:45:35 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, jtoppins@redhat.com, Shannon Nelson Subject: [PATCH net-next 5/9] ionic: generic filter add Date: Sat, 9 Oct 2021 11:45:19 -0700 Message-Id: <20211009184523.73154-6-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211009184523.73154-1-snelson@pensando.io> References: <20211009184523.73154-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In preparation for adding vlan overflow management, rework the ionic_lif_addr_add() function to something a little more generic that can be used for other filter types. Signed-off-by: Shannon Nelson --- .../ethernet/pensando/ionic/ionic_rx_filter.c | 68 +++++++++++++------ 1 file changed, 46 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c index 38109244a722..10837e41f819 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c @@ -301,22 +301,19 @@ int ionic_lif_list_addr(struct ionic_lif *lif, const u8 *addr, bool mode) return 0; } -int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) +static int ionic_lif_filter_add(struct ionic_lif *lif, + struct ionic_rx_filter_add_cmd *ac) { struct ionic_admin_ctx ctx = { .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), - .cmd.rx_filter_add = { - .opcode = IONIC_CMD_RX_FILTER_ADD, - .lif_index = cpu_to_le16(lif->index), - .match = cpu_to_le16(IONIC_RX_FILTER_MATCH_MAC), - }, }; - int nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); - bool mc = is_multicast_ether_addr(addr); struct ionic_rx_filter *f; + int nfilters; int err = 0; - memcpy(ctx.cmd.rx_filter_add.mac.addr, addr, ETH_ALEN); + ctx.cmd.rx_filter_add = *ac; + ctx.cmd.rx_filter_add.opcode = IONIC_CMD_RX_FILTER_ADD, + ctx.cmd.rx_filter_add.lif_index = cpu_to_le16(lif->index), spin_lock_bh(&lif->rx_filters.lock); f = ionic_rx_filter_find(lif, &ctx.cmd.rx_filter_add); @@ -338,37 +335,53 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) if (err) return err; - netdev_dbg(lif->netdev, "rx_filter add ADDR %pM\n", addr); - /* Don't bother with the write to FW if we know there's no room, * we can try again on the next sync attempt. */ - if ((lif->nucast + lif->nmcast) >= nfilters) - err = -ENOSPC; - else + switch (le16_to_cpu(ctx.cmd.rx_filter_add.match)) { + case IONIC_RX_FILTER_MATCH_MAC: + netdev_dbg(lif->netdev, "%s: rx_filter add ADDR %pM\n", + __func__, ctx.cmd.rx_filter_add.mac.addr); + nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); + if ((lif->nucast + lif->nmcast) >= nfilters) + err = -ENOSPC; + break; + } + + if (err != -ENOSPC) err = ionic_adminq_post_wait(lif, &ctx); spin_lock_bh(&lif->rx_filters.lock); + if (err && err != -EEXIST) { /* set the state back to NEW so we can try again later */ f = ionic_rx_filter_find(lif, &ctx.cmd.rx_filter_add); if (f && f->state == IONIC_FILTER_STATE_SYNCED) { f->state = IONIC_FILTER_STATE_NEW; - set_bit(IONIC_LIF_F_FILTER_SYNC_NEEDED, lif->state); + + /* If -ENOSPC we won't waste time trying to sync again + * until there is a delete that might make room + */ + if (err != -ENOSPC) + set_bit(IONIC_LIF_F_FILTER_SYNC_NEEDED, lif->state); } spin_unlock_bh(&lif->rx_filters.lock); if (err == -ENOSPC) return 0; - else - return err; + + return err; } - if (mc) - lif->nmcast++; - else - lif->nucast++; + switch (le16_to_cpu(ctx.cmd.rx_filter_add.match)) { + case IONIC_RX_FILTER_MATCH_MAC: + if (is_multicast_ether_addr(ctx.cmd.rx_filter_add.mac.addr)) + lif->nmcast++; + else + lif->nucast++; + break; + } f = ionic_rx_filter_find(lif, &ctx.cmd.rx_filter_add); if (f && f->state == IONIC_FILTER_STATE_OLD) { @@ -389,6 +402,17 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) return err; } +int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) +{ + struct ionic_rx_filter_add_cmd ac = { + .match = cpu_to_le16(IONIC_RX_FILTER_MATCH_MAC), + }; + + memcpy(&ac.mac.addr, addr, ETH_ALEN); + + return ionic_lif_filter_add(lif, &ac); +} + int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) { struct ionic_admin_ctx ctx = { @@ -493,7 +517,7 @@ void ionic_rx_filter_sync(struct ionic_lif *lif) } list_for_each_entry_safe(sync_item, spos, &sync_add_list, list) { - (void)ionic_lif_addr_add(lif, sync_item->f.cmd.mac.addr); + (void)ionic_lif_filter_add(lif, &sync_item->f.cmd); list_del(&sync_item->list); devm_kfree(dev, sync_item); From patchwork Sat Oct 9 18:45:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 12547969 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40C08C433F5 for ; Sat, 9 Oct 2021 18:45:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A58960F4B for ; Sat, 9 Oct 2021 18:45:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230111AbhJISrk (ORCPT ); Sat, 9 Oct 2021 14:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbhJISre (ORCPT ); Sat, 9 Oct 2021 14:47:34 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B22AEC061570 for ; Sat, 9 Oct 2021 11:45:37 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id pi19-20020a17090b1e5300b0019fdd3557d3so10245310pjb.5 for ; Sat, 09 Oct 2021 11:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gxCLblM/mDLCEortX/fPp/MWAq33Rm2s4118QI/0bT8=; b=rCG/Q/w37GxJGz0jA9fYKo1URqvAiFAECZoagJN+YhufGGLDFohPLIrQyDy1XCfYF0 4lC0u4d0ciTS3BkzrAx1vAH0y5wANa7kcTJl3B2eqnZD+r3iDxy3oCnmTSQWyipG/tpB WYjm9bsF2earzz6+B8/gsjSbjVg69iLcT0eJoKo0kxvUmRdIPWFB+oiH45hpZvO6dCGz joARErMnNd2PQj4qSNdvUzv1hWLZLI4u4aoD2M6wEWKiB5Ham3HzG2e2JRI/fBFoods5 bU6zihBPs09BBpjIPjGEOjiv3eZfl2tTQjsq8QLwYr8Mcr5AZzqVPJBZMeyzBv4nVGej Ff4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gxCLblM/mDLCEortX/fPp/MWAq33Rm2s4118QI/0bT8=; b=ld7oJA5+Sgd2qvko5irJbL1MvKeUoZH9pbTNDUl/ZkBbwP2/MylC9lpE/Kn7EWeAcj izw5FcZ9Z6kiZNnoH9vwS723MfR8jxXBa+TnPgGhUlbRd66qpXfKNIBvuUQQd5vBz0C/ QDoPfinmlHZthmpO3t7RC8yTP6QDBKmw7GIqQpgszzH6RuvQo/ldS6hZxEjm7zB2wCB4 sxUdzYrAiRFNTmB1QfvCM+W5u6oGeMDhnd4Wn563ei7PDt8NqXYbLDczdc/SIbZonCJS pO1S/eOX6v5vlgw2dFL1GwRCkk6/cCekbXsc4ExXI+5RpWLyXLyqS8cQ5LQOSjOTXOhU 6n2w== X-Gm-Message-State: AOAM532c/LUegmfMAk41Mii3WUVOK8foVadXzGazkelfgB0HNjr0SjOb 93fmxbb7hlnycNxSmjE8tw17vW5qVCMewA== X-Google-Smtp-Source: ABdhPJy8gzDMr4faXKO7vFx72E9zOWgs/+2i+xTNk6ijVeE/5nNR1kXDa+JDeGEvRM1RqOoKEDMMPQ== X-Received: by 2002:a17:90a:5889:: with SMTP id j9mr20155018pji.91.1633805137275; Sat, 09 Oct 2021 11:45:37 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id s30sm3368433pgo.39.2021.10.09.11.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 11:45:36 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, jtoppins@redhat.com, Shannon Nelson Subject: [PATCH net-next 6/9] ionic: generic filter delete Date: Sat, 9 Oct 2021 11:45:20 -0700 Message-Id: <20211009184523.73154-7-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211009184523.73154-1-snelson@pensando.io> References: <20211009184523.73154-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Similar to the filter add, make a generic filter delete. Signed-off-by: Shannon Nelson --- .../ethernet/pensando/ionic/ionic_rx_filter.c | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c index 10837e41f819..40a12b9df982 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c @@ -413,7 +413,8 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) return ionic_lif_filter_add(lif, &ac); } -int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) +static int ionic_lif_filter_del(struct ionic_lif *lif, + struct ionic_rx_filter_add_cmd *ac) { struct ionic_admin_ctx ctx = { .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), @@ -427,24 +428,27 @@ int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) int err; spin_lock_bh(&lif->rx_filters.lock); - f = ionic_rx_filter_by_addr(lif, addr); + f = ionic_rx_filter_find(lif, ac); if (!f) { spin_unlock_bh(&lif->rx_filters.lock); return -ENOENT; } - netdev_dbg(lif->netdev, "rx_filter del ADDR %pM (id %d)\n", - addr, f->filter_id); + switch (le16_to_cpu(ac->match)) { + case IONIC_RX_FILTER_MATCH_MAC: + netdev_dbg(lif->netdev, "%s: rx_filter del ADDR %pM id %d\n", + __func__, ac->mac.addr, f->filter_id); + if (is_multicast_ether_addr(ac->mac.addr) && lif->nmcast) + lif->nmcast--; + else if (!is_multicast_ether_addr(ac->mac.addr) && lif->nucast) + lif->nucast--; + break; + } state = f->state; ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id); ionic_rx_filter_free(lif, f); - if (is_multicast_ether_addr(addr) && lif->nmcast) - lif->nmcast--; - else if (!is_multicast_ether_addr(addr) && lif->nucast) - lif->nucast--; - spin_unlock_bh(&lif->rx_filters.lock); if (state != IONIC_FILTER_STATE_NEW) { @@ -456,6 +460,17 @@ int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) return 0; } +int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) +{ + struct ionic_rx_filter_add_cmd ac = { + .match = cpu_to_le16(IONIC_RX_FILTER_MATCH_MAC), + }; + + memcpy(&ac.mac.addr, addr, ETH_ALEN); + + return ionic_lif_filter_del(lif, &ac); +} + struct sync_item { struct list_head list; struct ionic_rx_filter f; @@ -510,7 +525,7 @@ void ionic_rx_filter_sync(struct ionic_lif *lif) * they can clear room for some new filters */ list_for_each_entry_safe(sync_item, spos, &sync_del_list, list) { - (void)ionic_lif_addr_del(lif, sync_item->f.cmd.mac.addr); + (void)ionic_lif_filter_del(lif, &sync_item->f.cmd); list_del(&sync_item->list); devm_kfree(dev, sync_item); From patchwork Sat Oct 9 18:45:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 12547973 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 568DDC433EF for ; Sat, 9 Oct 2021 18:45:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 437DB60F90 for ; Sat, 9 Oct 2021 18:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230264AbhJISrp (ORCPT ); Sat, 9 Oct 2021 14:47:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229928AbhJISrf (ORCPT ); Sat, 9 Oct 2021 14:47:35 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B30C061762 for ; Sat, 9 Oct 2021 11:45:38 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id t11so8331711plq.11 for ; Sat, 09 Oct 2021 11:45:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zqrdA9hmbN0YxI+DGUZ6MDC55gPnl4GEcET7fUQhqS4=; b=eAoQPoyNMcko6UG3y15Pj4c3DAEETUIwMmsqgk2FpfXbEcjxSoBHy51C4yTj1XaRPO l2W7QaOrXfl6AiuCx9/H8PbQm/WJqQb2nC++6Zwdv93G3KkKvVR6ryeKe7D5ri16Zyee GRy9dD2zsFe/RaP8kLfJ1xJJV+SmAAan2SMBX7lRIdWuB/ZwTohG9e1gf1sN6INIWD9b Za0XAyKeCfIU+vZ3nBJHU/8aIfrcBzqMlZTqxtcFP3crQ7yPLS8Vw07cHLPVrDcnedWq 7c+eS1+jds8ieCjzF9j8hWtHuU1mUhGA83X0hjMXKGzV0khokLOSGrGiOElgxbeeBWNn ud9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zqrdA9hmbN0YxI+DGUZ6MDC55gPnl4GEcET7fUQhqS4=; b=M6fiw/E8FrfMo1xpBT3kmP3QWwkdhKTig6mqgIZ1FZs8T9CcqwQF6W/m8+8a58F8h+ tVye8PRwQRg1lGLquWuyvUKEGvv5UF5FHg+eGuY2GE29eGdpf70TVEGwtPtydOTqg4zs 3ErEh29xTZEz8ixmx2Z0fq3He949ideWqs6w1B3qMmO53vxmWWjSRRCbHQlEiH8Veax0 X+4ZpysXArLVx7pwXraXwAPVJ1Y3ccZpTxqQV4WQqpkIY9fX8qvrpUIAhtCxTQP9cli6 GrVkpZuYTht6cmKz+XnMS5hBeY/JGP1Sn4NqzUSWudm/wW3UFmMCxVEkJyCasljOLpCp BX0g== X-Gm-Message-State: AOAM531yv80wmS09SksBq0ybraj+Ecz0HbgJvg8l3QpVaqQBOzy6qu7C 2T/+39eitk6rRx0ccASn89aiYg== X-Google-Smtp-Source: ABdhPJy38de5D7bJE0ReUbJEeKd+J0uRdPSVx/sR8mesXezuRR8+etxJK6D2u1fcNGW4DhXJkqsvjA== X-Received: by 2002:a17:90a:8c90:: with SMTP id b16mr18489553pjo.71.1633805138200; Sat, 09 Oct 2021 11:45:38 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id s30sm3368433pgo.39.2021.10.09.11.45.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 11:45:37 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, jtoppins@redhat.com, Shannon Nelson Subject: [PATCH net-next 7/9] ionic: handle vlan id overflow Date: Sat, 9 Oct 2021 11:45:21 -0700 Message-Id: <20211009184523.73154-8-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211009184523.73154-1-snelson@pensando.io> References: <20211009184523.73154-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add vlans to the existing rx_filter_sync mechanics currently used for managing mac filters. Older versions of our firmware had no enforced limits on the number of vlans that the LIF could request, but requesting large numbers of vlans caused issues in FW memory management, so an arbitrary limit was added in the FW. The FW now returns -ENOSPC when it hits that limit, which the driver needs to handle. Unfortunately, the FW doesn't advertise the vlan id limit, as it does with mac filters, so the driver won't know the limit until it bumps into it. We'll grab the current vlan id count and use that as the limit from there on and thus prevent getting any more -ENOSPC errors. Just as is done for the mac filters, the device puts the device into promiscuous mode when -ENOSPC is seen for vlan ids, and the driver will track the vlans that aren't synced to the FW. When vlans are removed, the driver will retry the un-synced vlans. If all outstanding vlans are synced, the promiscuous mode will be disabled. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_lif.c | 52 +++++-------------- .../net/ethernet/pensando/ionic/ionic_lif.h | 2 + .../ethernet/pensando/ionic/ionic_rx_filter.c | 41 ++++++++++++++- .../ethernet/pensando/ionic/ionic_rx_filter.h | 2 + 4 files changed, 56 insertions(+), 41 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c index 4a080612142a..893a80e36632 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1273,7 +1273,7 @@ void ionic_lif_rx_mode(struct ionic_lif *lif) rx_mode |= (nd_flags & IFF_PROMISC) ? IONIC_RX_MODE_F_PROMISC : 0; rx_mode |= (nd_flags & IFF_ALLMULTI) ? IONIC_RX_MODE_F_ALLMULTI : 0; - /* sync the mac filters */ + /* sync the filters */ ionic_rx_filter_sync(lif); /* check for overflow state @@ -1284,7 +1284,8 @@ void ionic_lif_rx_mode(struct ionic_lif *lif) */ nfilters = le32_to_cpu(lif->identity->eth.max_ucast_filters); - if ((lif->nucast + lif->nmcast) >= nfilters) { + if (((lif->nucast + lif->nmcast) >= nfilters) || + (lif->max_vlans && lif->nvlans >= lif->max_vlans)) { rx_mode |= IONIC_RX_MODE_F_PROMISC; rx_mode |= IONIC_RX_MODE_F_ALLMULTI; } else { @@ -1672,59 +1673,30 @@ static int ionic_vlan_rx_add_vid(struct net_device *netdev, __be16 proto, u16 vid) { struct ionic_lif *lif = netdev_priv(netdev); - struct ionic_admin_ctx ctx = { - .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), - .cmd.rx_filter_add = { - .opcode = IONIC_CMD_RX_FILTER_ADD, - .lif_index = cpu_to_le16(lif->index), - .match = cpu_to_le16(IONIC_RX_FILTER_MATCH_VLAN), - .vlan.vlan = cpu_to_le16(vid), - }, - }; int err; - netdev_dbg(netdev, "rx_filter add VLAN %d\n", vid); - err = ionic_adminq_post_wait(lif, &ctx); + err = ionic_lif_vlan_add(lif, vid); if (err) return err; - spin_lock_bh(&lif->rx_filters.lock); - err = ionic_rx_filter_save(lif, 0, IONIC_RXQ_INDEX_ANY, 0, &ctx, - IONIC_FILTER_STATE_SYNCED); - spin_unlock_bh(&lif->rx_filters.lock); + ionic_lif_rx_mode(lif); - return err; + return 0; } static int ionic_vlan_rx_kill_vid(struct net_device *netdev, __be16 proto, u16 vid) { struct ionic_lif *lif = netdev_priv(netdev); - struct ionic_admin_ctx ctx = { - .work = COMPLETION_INITIALIZER_ONSTACK(ctx.work), - .cmd.rx_filter_del = { - .opcode = IONIC_CMD_RX_FILTER_DEL, - .lif_index = cpu_to_le16(lif->index), - }, - }; - struct ionic_rx_filter *f; - - spin_lock_bh(&lif->rx_filters.lock); - - f = ionic_rx_filter_by_vlan(lif, vid); - if (!f) { - spin_unlock_bh(&lif->rx_filters.lock); - return -ENOENT; - } + int err; - netdev_dbg(netdev, "rx_filter del VLAN %d (id %d)\n", - vid, f->filter_id); + err = ionic_lif_vlan_del(lif, vid); + if (err) + return err; - ctx.cmd.rx_filter_del.filter_id = cpu_to_le32(f->filter_id); - ionic_rx_filter_free(lif, f); - spin_unlock_bh(&lif->rx_filters.lock); + ionic_lif_rx_mode(lif); - return ionic_adminq_post_wait(lif, &ctx); + return 0; } int ionic_lif_rss_config(struct ionic_lif *lif, const u16 types, diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index 541aa54e4ffd..9f7ab2f17f93 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -192,6 +192,8 @@ struct ionic_lif { u16 lif_type; unsigned int nmcast; unsigned int nucast; + unsigned int nvlans; + unsigned int max_vlans; char name[IONIC_LIF_NAME_MAX_SZ]; union ionic_lif_identity *identity; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c index 40a12b9df982..366f15794866 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c @@ -337,8 +337,16 @@ static int ionic_lif_filter_add(struct ionic_lif *lif, /* Don't bother with the write to FW if we know there's no room, * we can try again on the next sync attempt. + * Since the FW doesn't have a way to tell us the vlan limit, + * we start max_vlans at 0 until we hit the ENOSPC error. */ switch (le16_to_cpu(ctx.cmd.rx_filter_add.match)) { + case IONIC_RX_FILTER_MATCH_VLAN: + netdev_dbg(lif->netdev, "%s: rx_filter add VLAN %d\n", + __func__, ctx.cmd.rx_filter_add.vlan.vlan); + if (lif->max_vlans && lif->nvlans >= lif->max_vlans) + err = -ENOSPC; + break; case IONIC_RX_FILTER_MATCH_MAC: netdev_dbg(lif->netdev, "%s: rx_filter add ADDR %pM\n", __func__, ctx.cmd.rx_filter_add.mac.addr); @@ -368,13 +376,19 @@ static int ionic_lif_filter_add(struct ionic_lif *lif, spin_unlock_bh(&lif->rx_filters.lock); - if (err == -ENOSPC) + if (err == -ENOSPC) { + if (le16_to_cpu(ctx.cmd.rx_filter_add.match) == IONIC_RX_FILTER_MATCH_VLAN) + lif->max_vlans = lif->nvlans; return 0; + } return err; } switch (le16_to_cpu(ctx.cmd.rx_filter_add.match)) { + case IONIC_RX_FILTER_MATCH_VLAN: + lif->nvlans++; + break; case IONIC_RX_FILTER_MATCH_MAC: if (is_multicast_ether_addr(ctx.cmd.rx_filter_add.mac.addr)) lif->nmcast++; @@ -413,6 +427,16 @@ int ionic_lif_addr_add(struct ionic_lif *lif, const u8 *addr) return ionic_lif_filter_add(lif, &ac); } +int ionic_lif_vlan_add(struct ionic_lif *lif, const u16 vid) +{ + struct ionic_rx_filter_add_cmd ac = { + .match = cpu_to_le16(IONIC_RX_FILTER_MATCH_VLAN), + .vlan.vlan = cpu_to_le16(vid), + }; + + return ionic_lif_filter_add(lif, &ac); +} + static int ionic_lif_filter_del(struct ionic_lif *lif, struct ionic_rx_filter_add_cmd *ac) { @@ -435,6 +459,11 @@ static int ionic_lif_filter_del(struct ionic_lif *lif, } switch (le16_to_cpu(ac->match)) { + case IONIC_RX_FILTER_MATCH_VLAN: + netdev_dbg(lif->netdev, "%s: rx_filter del VLAN %d id %d\n", + __func__, ac->vlan.vlan, f->filter_id); + lif->nvlans--; + break; case IONIC_RX_FILTER_MATCH_MAC: netdev_dbg(lif->netdev, "%s: rx_filter del ADDR %pM id %d\n", __func__, ac->mac.addr, f->filter_id); @@ -471,6 +500,16 @@ int ionic_lif_addr_del(struct ionic_lif *lif, const u8 *addr) return ionic_lif_filter_del(lif, &ac); } +int ionic_lif_vlan_del(struct ionic_lif *lif, const u16 vid) +{ + struct ionic_rx_filter_add_cmd ac = { + .match = cpu_to_le16(IONIC_RX_FILTER_MATCH_VLAN), + .vlan.vlan = cpu_to_le16(vid), + }; + + return ionic_lif_filter_del(lif, &ac); +} + struct sync_item { struct list_head list; struct ionic_rx_filter f; diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.h b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.h index a66e35f0833b..87b2666f248b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.h @@ -44,5 +44,7 @@ struct ionic_rx_filter *ionic_rx_filter_rxsteer(struct ionic_lif *lif); void ionic_rx_filter_sync(struct ionic_lif *lif); int ionic_lif_list_addr(struct ionic_lif *lif, const u8 *addr, bool mode); int ionic_rx_filters_need_sync(struct ionic_lif *lif); +int ionic_lif_vlan_add(struct ionic_lif *lif, const u16 vid); +int ionic_lif_vlan_del(struct ionic_lif *lif, const u16 vid); #endif /* _IONIC_RX_FILTER_H_ */ From patchwork Sat Oct 9 18:45:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 12547971 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F08E8C433F5 for ; Sat, 9 Oct 2021 18:45:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D8C1760F6B for ; Sat, 9 Oct 2021 18:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230139AbhJISrm (ORCPT ); Sat, 9 Oct 2021 14:47:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229953AbhJISrg (ORCPT ); Sat, 9 Oct 2021 14:47:36 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A791AC061765 for ; Sat, 9 Oct 2021 11:45:39 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id y1so8327644plk.10 for ; Sat, 09 Oct 2021 11:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KFVrmI+VwxARD0YXtleUXOZ2XB+QWxCC2EAnTr4D6Sw=; b=lGCCoonBWaj+qv4Spu4e1wFex4JzXSZ8w1abDEb+a522m+9NxJgh8hvLy6AAhpeV9m QMw4LkTGeey1sGnyqR8iVu6sIyb5n2lKjB1ZJx9t5+80BYKYSeErsZiZTH3LoKAaJY4o DL9+9StyNXG1ClSXgjUwIfFq6nS1LTEZ9bIvW28cP4VvF8C+7+hBTjH71n28ofCzX6YE PrRihlMbn5u9pPtwGM3Z+0UrLPUay9RObaFQfu92yFDJpqMPp0or6l6LASlhMYNJQPTH kmIZeIkiwA45p/SpdMszjeD9UhlHSaS2vRYTiZ0smtJqHP3iVLMwOhyIUSRtPtASg0tv NKew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KFVrmI+VwxARD0YXtleUXOZ2XB+QWxCC2EAnTr4D6Sw=; b=AyQZhe70r38vhqqeUHBaRRVsyJEMowgtgJxfmJi0fBy9YgYxDp7y5J3yfBUlJDPHUJ m2kCZ9Sgc9XbfMxa3fpry4IrJBWjzpbbx/csZJYoUGMt/hcJ5H2DWJnhBMStU6q0gPf6 2+cE4edMuHp/UGfAtbFoxAMrzowxNtqSneCFjQczXNToCLlLYaeOVpK21zpufYzcKk6R KOUbUjZeVOPId83U9Vvj7Q6jrNBVS1w1lJO09S82iIVABVO3hS8HyrL+Fqtmta2Gd+8n +0oeARBc0YsGwD23n1vX21Ab2iAgRd9xSzhPlNfg8ANR0eEh+28A9HpMsH8uv05C6fVH 9HWA== X-Gm-Message-State: AOAM532aQQZt9ziPipCqmH0IHp7IlMyTYQIlTyUrA3nSxsJcf1YOpWH8 Mq+75J+UXh6sPL6EUw2OSBttJw== X-Google-Smtp-Source: ABdhPJy5SJlJk5tf8f9rDlyoP49EOYn/mUmxGeFIGpbci1mcC+DdrZthphh6gRrczfcBG3mp3CSbVg== X-Received: by 2002:a17:902:760b:b0:13b:122:5ff0 with SMTP id k11-20020a170902760b00b0013b01225ff0mr15959678pll.22.1633805139182; Sat, 09 Oct 2021 11:45:39 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id s30sm3368433pgo.39.2021.10.09.11.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 11:45:38 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, jtoppins@redhat.com, Shannon Nelson Subject: [PATCH net-next 8/9] ionic: allow adminq requests to override default error message Date: Sat, 9 Oct 2021 11:45:22 -0700 Message-Id: <20211009184523.73154-9-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211009184523.73154-1-snelson@pensando.io> References: <20211009184523.73154-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The AdminQ handler has an error handler that automatically prints an error message when the request has failed. However, there are situations where the caller can expect that it might fail and has an alternative strategy, thus may not want the error message sent to the log, such as hitting -ENOSPC when adding a new vlan id. We add a new interface to the AdminQ API to allow for override of the default behavior, and an interface to the use standard error message formatting. Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic.h | 7 ++- .../net/ethernet/pensando/ionic/ionic_main.c | 47 +++++++++++++------ .../net/ethernet/pensando/ionic/ionic_phc.c | 8 ++-- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h index d570d03b23f6..5e25411ff02f 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic.h +++ b/drivers/net/ethernet/pensando/ionic/ionic.h @@ -70,8 +70,13 @@ struct ionic_admin_ctx { }; int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx); -int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, int err); +int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, + const int err, const bool do_msg); int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx); +int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx); +void ionic_adminq_netdev_err_print(struct ionic_lif *lif, u8 opcode, + u8 status, int err); + int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait); int ionic_set_dma_mask(struct ionic *ionic); int ionic_setup(struct ionic *ionic); diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index bb49f1b8ef67..875f4ec42efe 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -212,24 +212,28 @@ static void ionic_adminq_flush(struct ionic_lif *lif) spin_unlock_irqrestore(&lif->adminq_lock, irqflags); } +void ionic_adminq_netdev_err_print(struct ionic_lif *lif, u8 opcode, + u8 status, int err) +{ + netdev_err(lif->netdev, "%s (%d) failed: %s (%d)\n", + ionic_opcode_to_str(opcode), opcode, + ionic_error_to_str(status), err); +} + static int ionic_adminq_check_err(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, - bool timeout) + const bool timeout, + const bool do_msg) { - struct net_device *netdev = lif->netdev; - const char *opcode_str; - const char *status_str; int err = 0; if (ctx->comp.comp.status || timeout) { - opcode_str = ionic_opcode_to_str(ctx->cmd.cmd.opcode); - status_str = ionic_error_to_str(ctx->comp.comp.status); err = timeout ? -ETIMEDOUT : ionic_error_to_errno(ctx->comp.comp.status); - netdev_err(netdev, "%s (%d) failed: %s (%d)\n", - opcode_str, ctx->cmd.cmd.opcode, - timeout ? "TIMEOUT" : status_str, err); + if (do_msg) + ionic_adminq_netdev_err_print(lif, ctx->cmd.cmd.opcode, + ctx->comp.comp.status, err); if (timeout) ionic_adminq_flush(lif); @@ -298,7 +302,8 @@ int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) return err; } -int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, int err) +int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, + const int err, const bool do_msg) { struct net_device *netdev = lif->netdev; unsigned long time_limit; @@ -310,7 +315,7 @@ int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, int er name = ionic_opcode_to_str(ctx->cmd.cmd.opcode); if (err) { - if (!test_bit(IONIC_LIF_F_FW_RESET, lif->state)) + if (do_msg && !test_bit(IONIC_LIF_F_FW_RESET, lif->state)) netdev_err(netdev, "Posting of %s (%d) failed: %d\n", name, ctx->cmd.cmd.opcode, err); return err; @@ -328,8 +333,9 @@ int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, int er /* interrupt the wait if FW stopped */ if (test_bit(IONIC_LIF_F_FW_RESET, lif->state)) { - netdev_err(netdev, "%s (%d) interrupted, FW in reset\n", - name, ctx->cmd.cmd.opcode); + if (do_msg) + netdev_err(netdev, "%s (%d) interrupted, FW in reset\n", + name, ctx->cmd.cmd.opcode); return -ENXIO; } @@ -339,7 +345,9 @@ int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, int er dev_dbg(lif->ionic->dev, "%s: elapsed %d msecs\n", __func__, jiffies_to_msecs(time_done - time_start)); - return ionic_adminq_check_err(lif, ctx, time_after_eq(time_done, time_limit)); + return ionic_adminq_check_err(lif, ctx, + time_after_eq(time_done, time_limit), + do_msg); } int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) @@ -348,7 +356,16 @@ int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) err = ionic_adminq_post(lif, ctx); - return ionic_adminq_wait(lif, ctx, err); + return ionic_adminq_wait(lif, ctx, err, true); +} + +int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) +{ + int err; + + err = ionic_adminq_post(lif, ctx); + + return ionic_adminq_wait(lif, ctx, err, false); } static void ionic_dev_cmd_clean(struct ionic *ionic) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_phc.c b/drivers/net/ethernet/pensando/ionic/ionic_phc.c index eed2db69d708..887046838b3b 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_phc.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_phc.c @@ -348,7 +348,7 @@ static int ionic_phc_adjfine(struct ptp_clock_info *info, long scaled_ppm) spin_unlock_irqrestore(&phc->lock, irqflags); - return ionic_adminq_wait(phc->lif, &ctx, err); + return ionic_adminq_wait(phc->lif, &ctx, err, true); } static int ionic_phc_adjtime(struct ptp_clock_info *info, s64 delta) @@ -373,7 +373,7 @@ static int ionic_phc_adjtime(struct ptp_clock_info *info, s64 delta) spin_unlock_irqrestore(&phc->lock, irqflags); - return ionic_adminq_wait(phc->lif, &ctx, err); + return ionic_adminq_wait(phc->lif, &ctx, err, true); } static int ionic_phc_settime64(struct ptp_clock_info *info, @@ -402,7 +402,7 @@ static int ionic_phc_settime64(struct ptp_clock_info *info, spin_unlock_irqrestore(&phc->lock, irqflags); - return ionic_adminq_wait(phc->lif, &ctx, err); + return ionic_adminq_wait(phc->lif, &ctx, err, true); } static int ionic_phc_gettimex64(struct ptp_clock_info *info, @@ -459,7 +459,7 @@ static long ionic_phc_aux_work(struct ptp_clock_info *info) spin_unlock_irqrestore(&phc->lock, irqflags); - ionic_adminq_wait(phc->lif, &ctx, err); + ionic_adminq_wait(phc->lif, &ctx, err, true); return phc->aux_work_delay; } From patchwork Sat Oct 9 18:45:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 12547975 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4372C433FE for ; Sat, 9 Oct 2021 18:45:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CAD1260F6B for ; Sat, 9 Oct 2021 18:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230289AbhJISrr (ORCPT ); Sat, 9 Oct 2021 14:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230016AbhJISri (ORCPT ); Sat, 9 Oct 2021 14:47:38 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F3E8C061765 for ; Sat, 9 Oct 2021 11:45:40 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id q10-20020a17090a1b0a00b001a076a59640so618556pjq.0 for ; Sat, 09 Oct 2021 11:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4lWBYcfjuL+whODjagk0vnAumNnMPDqSxv60oiFH3/c=; b=zur8F/001JVwDKGwEPJIDFp790m6UzN4h6lEpBbkPTzvhPPTuh2tpv9Ae0eYstEJYx zbXk0GRzIGMk58V7gupMcX9oCFMd32AjwCvDQRTxuuGh9bu+DHutEHLaFekcluzp6tsT ZdxlclRumxS7i+c9b3LFyYRCKBvOjUGi67OmF6VmHZk6q5jMjMyclULKbOZPv5RAp27l B1hqMXinOScXRdVwy6n67wqeSTgdx4ETw5fh27y0Mrei1cMlCT1L7PETkppQ4XO5SjGi is8be3iClaGMTcyJQtCf3NJtGxEpw60ttfsnFqnh7SF3x/9MimqRAn9vGK/sSUkoSvTf Ec/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4lWBYcfjuL+whODjagk0vnAumNnMPDqSxv60oiFH3/c=; b=daWjqHMmsAwPzKn/ZBlm8wllgCVwqWrJdlq9SckiTFAJHc5bfrAGc4iM0QfaRPuVeX 4+Vh4+msrKjRJCByFRFA+ZhmgSND0RidwVN0SSReBMhFF/rIc3L4GTuBorIYLAMenTRo jyj7xQy330PNH2SMwAKGYd3oHVYR7NGc3rJ/Zu7P4j4xa9fezPMaNl13IYmumBx+5IEw MKnOMZGUqbBTfu2b+vmVJwCZP3AtSG0Pav9b5e4dbULFQC1TGayq4t3dtE94pU3zLL8Y 9gMDjAunGR9I+1IqM9IxPPFo0xOGs8ds5vxE+MPhhEUr+8fNv4OGq+zA27NP47NImVMf NIkQ== X-Gm-Message-State: AOAM531l5elyeaRzpLCH3zSTYecPU64HSGdYfwT1J+yoU6mp/pIdO83N xtk+m52IMN+xDZ+D/Bibvp7/0A== X-Google-Smtp-Source: ABdhPJylXuFlM8x3f2SmjFsvmS4IXm1sk6q3SZy01VGfW4vAYKvaMpyJiNUElZUHl7iDnlFKamnlPg== X-Received: by 2002:a17:90a:af92:: with SMTP id w18mr19427909pjq.98.1633805140215; Sat, 09 Oct 2021 11:45:40 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id s30sm3368433pgo.39.2021.10.09.11.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 11:45:39 -0700 (PDT) From: Shannon Nelson To: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org Cc: drivers@pensando.io, jtoppins@redhat.com, Shannon Nelson Subject: [PATCH net-next 9/9] ionic: tame the filter no space message Date: Sat, 9 Oct 2021 11:45:23 -0700 Message-Id: <20211009184523.73154-10-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211009184523.73154-1-snelson@pensando.io> References: <20211009184523.73154-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Override the automatic AdminQ error message in order to capture the potential No Space message when we hit the max vlan limit, and add additional messaging to detail what filter failed. Signed-off-by: Shannon Nelson --- .../net/ethernet/pensando/ionic/ionic_rx_filter.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c index 366f15794866..f6e785f949f9 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_rx_filter.c @@ -357,7 +357,7 @@ static int ionic_lif_filter_add(struct ionic_lif *lif, } if (err != -ENOSPC) - err = ionic_adminq_post_wait(lif, &ctx); + err = ionic_adminq_post_wait_nomsg(lif, &ctx); spin_lock_bh(&lif->rx_filters.lock); @@ -382,6 +382,19 @@ static int ionic_lif_filter_add(struct ionic_lif *lif, return 0; } + ionic_adminq_netdev_err_print(lif, ctx.cmd.cmd.opcode, + ctx.comp.comp.status, err); + switch (le16_to_cpu(ctx.cmd.rx_filter_add.match)) { + case IONIC_RX_FILTER_MATCH_VLAN: + netdev_info(lif->netdev, "rx_filter add failed: VLAN %d\n", + ctx.cmd.rx_filter_add.vlan.vlan); + break; + case IONIC_RX_FILTER_MATCH_MAC: + netdev_info(lif->netdev, "rx_filter add failed: ADDR %pM\n", + ctx.cmd.rx_filter_add.mac.addr); + break; + } + return err; }