Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1337293

Re: [PATCH v2 net-next 6/8] net: mvneta: bm: add support for hardware buffer management

From Marcin Wojtas <mw@semihalf.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 net-next 6/8] net: mvneta: bm: add support for hardware buffer management
Date 2016-02-18 12:50 +0100
Message-ID <r3vfQ-4SJ-5@gated-at.bofh.it> (permalink)
References <r2PTj-1fi-3@gated-at.bofh.it> <r2PTm-1fi-65@gated-at.bofh.it> <r3oHo-fk-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi David,


2016-02-18 5:43 GMT+01:00 David Miller <davem@davemloft.net>:
> From: Gregory CLEMENT <gregory.clement@free-electrons.com>
> Date: Tue, 16 Feb 2016 16:33:41 +0100
>
>>       pp->dev = dev;
>>       SET_NETDEV_DEV(dev, &pdev->dev);
>>
>> +     dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
>> +     dev->hw_features |= dev->features;
>> +     dev->vlan_features |= dev->features;
>> +     dev->priv_flags |= IFF_UNICAST_FLT;
>> +     dev->gso_max_segs = MVNETA_MAX_TSO_SEGS;
>> +
>> +     err = register_netdev(dev);
>> +     if (err < 0) {
>> +             dev_err(&pdev->dev, "failed to register\n");
>> +             goto err_free_stats;
>> +     }
>> +
>> +     pp->id = dev->ifindex;
>> +
>> +     /* Obtain access to BM resources if enabled and already initialized */
>> +     bm_node = of_parse_phandle(dn, "buffer-manager", 0);
>> +     if (bm_node && bm_node->data) {
>
> This set of changes has a lot of problems.
>
> First, the exact moment you call register_netdev() your device must be
> fully initialized because ->open() can be invoked immediately.  This
> means you must take care of all of this buffer manager stuff before
> calling register_netdev().
>
> It must precisely be the last thing you invoke in your probe function
> for this reason.

Ok. I shifted register_netdev in order to obtain port id dynamically
from netdev's ifindex (needed to control port <-> pool mapping). If
this order of registration is problematic, I will add an ID property
to DT.

>
> Also you are now adding conditionalized code to every fastpath in your
> driver, that is rediculous and is going to hurt performance.
>
> Add seperate code paths for the HWBM vs SWBM, and register a unique
> set of netdev_ops as appropriate.

TX is untouched and BM support affects only open, stop and change_mtu
- whose execution is not problematic in terms of performance. However
there are a couple new conditions in mvneta_rx(). It can be reduced to
a single condition check, moved to NAPI callback. I'll try to refactor
code in a way to avoid code duplication. Please bear in mind I don't
want to register to different NAPI functions (exactly the same apart
from one line), as the driver can fall back to SWBM after e.g.
unsuccessful mtu change.

Best regards,
Marcin

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v2 net-next 0/8] API set for HW Buffer management Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-02-16 16:40 +0100
  [PATCH v2 4/8] ARM: dts: armada-xp: enable buffer manager support on Armada XP boards Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-02-16 16:40 +0100
  Re: [PATCH v2 net-next 0/8] API set for HW Buffer management Willy Tarreau <w@1wt.eu> - 2016-02-18 00:10 +0100
    Re: [PATCH v2 net-next 0/8] API set for HW Buffer management Gregory CLEMENT <gregory.clement@free-electrons.com> - 2016-02-18 18:40 +0100
  Re: [PATCH v2 net-next 6/8] net: mvneta: bm: add support for  hardware buffer management David Miller <davem@davemloft.net> - 2016-02-18 05:50 +0100
    Re: [PATCH v2 net-next 6/8] net: mvneta: bm: add support for hardware  buffer management Marcin Wojtas <mw@semihalf.com> - 2016-02-18 12:50 +0100

csiph-web