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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham 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 1E5F7C43381 for ; Tue, 26 Mar 2019 22:38:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D49B62087C for ; Tue, 26 Mar 2019 22:38:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z0efApU6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731483AbfCZWiE (ORCPT ); Tue, 26 Mar 2019 18:38:04 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42604 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730605AbfCZWiE (ORCPT ); Tue, 26 Mar 2019 18:38:04 -0400 Received: by mail-wr1-f65.google.com with SMTP id g3so12763076wrx.9 for ; Tue, 26 Mar 2019 15:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aldlJCOjY+cxiWpNV3Yma9qiB56Id1GzXvFD9fS/gqs=; b=Z0efApU6J2b/b8w9rkFh/Yliu5mOkAHpwTMtXbdyUPQfLJ8YaNf/t9jRiEH4SPIoZs i67nIuDpTBATc+fPAfEjBy+zGuAUqBsHpV1xSQbupSPU5I/F3hlhPJB0usoFTv/DnSG/ v55qKDLKA8UcNcWde0Fb6dgAAmcMyLKd6r3OK6oItPu/J8gOgSBbVmTfX667sXWbX6q3 ukIvpJ2fIekq1HEw17JYjrKszgSjAPKr/AQi+w7EzOGI5aEUpfBaStoFa5Ak7WQ2vtPr jtCOoA+hVy+sN6h+zc4eerSIM68r+LBJcqjFfmWj/SJJKNt31JLXfCHpG+hAPkYC/e62 /RuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aldlJCOjY+cxiWpNV3Yma9qiB56Id1GzXvFD9fS/gqs=; b=ECnqqCJs+HdC48m4ln1592eblpepAgXMrYu2GS5P86wYO//i2kuyzpMHzr9prGXoY7 S0Ju7xUOrS+heyvwroFsMGBmchv3XoStP8wCOMavvF1Zz5l5sxTz1ERdYlSjxe9XWCfx MF7AKej6E6IAKc7t3Vr/wJzoJBhZktMdaklnnJtbEZuNmCvIXbORrRciZ8PwyVEYhJMw C1OHLQFxbJdtZDtiD4t/lucUebavIzjQEcXU/y7qxl5IllZadK4P8pPa5+ugPvmes2Wa NokuXqT8jDIdZP4Prc+o0h6D/XTeFBYXW9yacgY25jP64tEi8IWqS7FIousAyKBEQeBk w1Yg== X-Gm-Message-State: APjAAAVNVrvVko52NbsEvEh+Gv2lMENUWF03AzwOqI7rWOAUee2xM/EL MedmzRx4/dMnl8DU05e47b4= X-Google-Smtp-Source: APXvYqx+j2q3PzRLIGvUmN2+ijF+pO6Oy1BNOABPaM+c16ZT4tMMsvcS7JY2iZEFKU5AX9+80mQUlw== X-Received: by 2002:adf:b612:: with SMTP id f18mr3838427wre.236.1553639881852; Tue, 26 Mar 2019 15:38:01 -0700 (PDT) Received: from [192.168.1.2] ([188.26.228.227]) by smtp.gmail.com with ESMTPSA id z19sm12761204wml.44.2019.03.26.15.38.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 15:38:01 -0700 (PDT) Subject: Re: [RFC PATCH net-next 10/13] net: dsa: sja1105: Add support for traffic through standalone ports To: Florian Fainelli , davem@davemloft.net, netdev@vger.kernel.org Cc: andrew@lunn.ch, vivien.didelot@gmail.com, linus.walleij@linaro.org References: <20190324032346.32394-1-olteanv@gmail.com> <20190324032346.32394-11-olteanv@gmail.com> <2612a31e-ddde-d19d-40a0-80f1be5ac919@gmail.com> <80774235-c0d7-ad94-b644-490069f8e087@gmail.com> From: Vladimir Oltean Message-ID: <503dd37e-aa84-57b5-2473-bb0e0a98d615@gmail.com> Date: Wed, 27 Mar 2019 00:38:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <80774235-c0d7-ad94-b644-490069f8e087@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 3/27/19 12:13 AM, Florian Fainelli wrote: > On 3/26/19 3:03 PM, Vladimir Oltean wrote: >> On 3/26/19 4:31 AM, Florian Fainelli wrote: >>> >>> >>> On 3/23/2019 8:23 PM, Vladimir Oltean wrote: >>>> In order to support this, we are creating a make-shift switch tag out of >>>> a VLAN trunk configured on the CPU port. Termination on switch ports >>>> only works when not under a vlan_filtering bridge. We are making use of >>>> the generic CONFIG_NET_DSA_TAG_8021Q code and leveraging it from our own >>>> CONFIG_NET_DSA_TAG_SJA1105. >>>> >>>> There are two types of traffic: regular and link-local. >>>> The link-local traffic received on the CPU port is trapped from the >>>> switch's regular forwarding decisions because it matched one of the two >>>> DMAC filters for management traffic. >>>> On transmission, the switch requires special massaging for these >>>> link-local frames. Due to a weird implementation of the switching IP, by >>>> default it drops link-local frames that originate on the CPU port. It >>>> needs to be told where to forward them to, through an SPI command >>>> ("management route") that is valid for only a single frame. >>>> So when we're sending link-local traffic, we need to clone skb's from >>>> DSA and send them in our custom xmit worker that also performs SPI >>>> access. >>>> >>>> For that purpose, the DSA xmit handler and the xmit worker communicate >>>> through a per-port "skb ring" software structure, with a producer and a >>>> consumer index. At the moment this structure is rather fragile >>>> (ping-flooding to a link-local DMAC would cause most of the frames to >>>> get dropped). I would like to move the management traffic on a separate >>>> netdev queue that I can stop when the skb ring got full and hardware is >>>> busy processing, so that we are not forced to drop traffic. >>>> >>>> Signed-off-by: Vladimir Oltean >>> >>> Reviewed-by: Florian Fainelli >>> >>> I do like the idea of setting up specific management queue later on, >>> although it is not clear to me how you would go about integrating it as >>> a network device, given the DSA slave and master devices, do you know >>> roughly how you would proceed? >>> >> >> Actually I was thinking about leveraging the multiqueue support that you >> added in 55199df6d2af ("net: dsa: Allow switch drivers to indicate >> number of TX queues") and expose the slave netdev .ndo_select_queue >> callback towards DSA ports. There I would return queue #0 if >> sja1105_is_link_local(skb), and queue #1 otherwise. >> Are there any complications that I'm missing? > > So that queue could be used to steer management traffic, but it would > still attempt to perform a dev_queue_xmit() using the master DSA network > device unless you somehow change that and/or parent that queue to a > different network device that the sja1105 switch driver creates (which > is doable). > But the problem I'm trying to solve with the management queue is not congestion on the master port or inside the switch, but a problem that I myself have created by putting some skb's in a ring that is finite (and small) in size: the DSA xmit racing with my xmit worker. Congestion management on the switch is a much ampler issue that I don't yet know how to handle. The MACs don't appear to generate pause frames, and the pause frames that they receive are trapped to the CPU as link-local traffic (DMAC 01-80-C2-00-00-01) where they are simply consumed by the master's MAC. -Vladimir