21 Dec, 2019

1 commit


31 Jul, 2019

1 commit

  • Add DSA tag code for Microchip KSZ8795 switch. The switch is simpler
    and the tag is only 1 byte, instead of 2 as is the case with KSZ9477.

    Signed-off-by: Tristram Ha
    Signed-off-by: Marek Vasut
    Cc: Andrew Lunn
    Cc: David S. Miller
    Cc: Florian Fainelli
    Cc: Tristram Ha
    Cc: Vivien Didelot
    Cc: Woojung Huh
    Signed-off-by: David S. Miller

    Tristram Ha
     

29 Apr, 2019

7 commits

  • Now that tag drivers dynamically register, we don't need the static
    table. Remove it. This also means the tag driver structures can be
    made static.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • A DSA tag driver module will need to register the tag protocols it
    implements with the DSA core. Add macros containing this boiler plate.

    The registration/unregistration code is currently just a stub. A Later
    patch will add the real implementation.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli

    v2
    Fix indent of #endif
    Rewrite to move list pointer into a new structure
    v3
    Move kdoc next to macro
    Fix THIS_MODULE indentation

    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • In order that we can match the tagging protocol a switch driver
    request to the tagger, we need to know what protocol the tagger
    supports. Add this information to the ops structure.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli

    v2
    More tag protocol to end of structure to keep hot members at the beginning.

    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • All the tag drivers are some variant of GPL. Add a MODULE_LICENSE()
    indicating this, so the drivers can later be compiled as modules.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • When the tag drivers become modules, we will need to dynamically load
    them based on what the switch drivers need. Add aliases to map between
    the TAG protocol and the driver.

    In order to do this, we need the tag protocol number as something
    which the C pre-processor can stringinfy. Only the compiler knows the
    value of an enum, CPP cannot use them. So add #defines.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • Rather than keep a list to map a tagger ops to a name, place the name
    into the ops structure. This removes the hard coded list, a step
    towards making the taggers more dynamic.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli

    v2:
    Move name to end of structure, keeping the hot entries at the beginning.

    Signed-off-by: David S. Miller

    Andrew Lunn
     
  • Add an SPDX header, and remove the license boilerplate text.

    Signed-off-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Andrew Lunn
     

04 Mar, 2019

1 commit

  • KSZ9893 switch is similar to KSZ9477 switch except the ingress tail tag
    has 1 byte instead of 2 bytes. The size of the portmap is smaller and
    so the override and lookup bits are also moved.

    Signed-off-by: Tristram Ha
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Tristram Ha
     

12 Feb, 2019

1 commit

  • The flag offload_fwd_mark is set as the switch can forward frames by
    itself.

    This can be considered a fix to a problem introduced in commit
    c2e866911e254067 where the port membership are not set in sync. The flag
    offload_fwd_mark just needs to be set in tag_ksz.c to prevent the software
    bridge from forwarding duplicate multicast frames.

    Fixes: c2e866911e254067 ("microchip: break KSZ9477 DSA driver into two files")
    Signed-off-by: Tristram Ha
    Signed-off-by: David S. Miller

    Tristram Ha
     

17 Dec, 2018

3 commits

  • In case the destination address is link local, add override bit into the
    switch tag to let such a packet through the switch even if the port is
    blocked.

    Signed-off-by: Marek Vasut
    Cc: Tristram Ha
    Cc: Vivien Didelot
    Cc: Woojung Huh
    Cc: David S. Miller
    Reviewed-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Marek Vasut
     
  • Factor out common code from the tag_ksz , so that the code can be used
    with other KSZ family switches which use differenly sized tags.

    Signed-off-by: Tristram Ha
    Signed-off-by: Marek Vasut
    Cc: Vivien Didelot
    Cc: Woojung Huh
    Cc: David S. Miller
    Reviewed-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Tristram Ha
     
  • Rename the tag Kconfig option and related macros in preparation for
    addition of new KSZ family switches with different tag formats.

    Signed-off-by: Tristram Ha
    Signed-off-by: Marek Vasut
    Cc: Vivien Didelot
    Cc: Woojung Huh
    Cc: David S. Miller
    Reviewed-by: Andrew Lunn
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Tristram Ha
     

07 Dec, 2018

1 commit

  • Each DSA tag protocol needs to add additional headers to the Ethernet
    frame in order to direct it towards a specific switch egress port. It
    must also remove the head from a frame received from a
    switch. Indicate the maximum size of these headers in the tag protocol
    ops structure, so the core can take these overheads into account.

    Signed-off-by: Andrew Lunn
    Signed-off-by: David S. Miller

    Andrew Lunn
     

18 Oct, 2017

2 commits

  • The dsa_master_get_slave is slightly confusing since the idiomatic "get"
    term often suggests reference counting, in symmetry to "put".

    Rename it to dsa_master_find_slave to make the look up operation clear.

    Signed-off-by: Vivien Didelot
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • Many portions of DSA core code require to get the dsa_port structure
    corresponding to a slave net_device. For this purpose, introduce a
    dsa_slave_to_port() helper.

    Signed-off-by: Vivien Didelot
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Vivien Didelot
     

01 Oct, 2017

1 commit

  • The DSA tagging code does not need to know about the DSA architecture,
    it only needs to return the slave device corresponding to the source
    port index (and eventually the source device index for cascade-capable
    switches) parsed from the frame received on the master device.

    For this purpose, provide an inline dsa_master_get_slave helper which
    validates the device and port indexes and look up the slave device.

    This makes the tagging rcv functions more concise and robust, and also
    makes dsa_get_cpu_port obsolete.

    Signed-off-by: Vivien Didelot
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Vivien Didelot
     

02 Sep, 2017

1 commit


24 Aug, 2017

2 commits

  • Two kfree_skb() should be consume_skb(), to be friend with drop monitor
    (perf record ... -e skb:kfree_skb)

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • The first call of skb_put_padto() will free up the SKB on error, but we
    return NULL which tells dsa_slave_xmit() that the original SKB should be
    freed so this would lead to a double free here.

    The second skb_put_padto() already frees the passed sk_buff reference
    upon error, so calling kfree_skb() on it again is not necessary.

    Detected by CoverityScan, CID#1416687 ("USE_AFTER_FREE")

    Fixes: e71cb9e00922 ("net: dsa: ksz: fix skb freeing")
    Signed-off-by: Florian Fainelli
    Reviewed-by: Woojung Huh
    Signed-off-by: David S. Miller

    Florian Fainelli
     

22 Aug, 2017

1 commit


12 Aug, 2017

1 commit

  • The DSA layer frees the original skb when an xmit function returns NULL,
    meaning an error occurred. But if the tagging code copied the original
    skb, it is responsible of freeing the copy if an error occurs.

    The ksz tagging code currently has two issues: if skb_put_padto fails,
    the skb copy is not freed, and the original skb will be freed twice.

    To fix that, move skb_put_padto inside both branches of the skb_tailroom
    condition, before freeing the original skb, and free the copy on error.

    Signed-off-by: Vivien Didelot
    Reviewed-by: Woojung Huh
    Signed-off-by: David S. Miller

    Vivien Didelot
     

14 Jun, 2017

1 commit

  • Introduce a helper function which will return a reference to the CPU
    port used in a dsa_switch_tree. Right now this is a singleton, but this
    will change once we introduce multi-CPU port support, so ease the
    transition by converting the affected code paths.

    Reviewed-by: Vivien Didelot
    Signed-off-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Florian Fainelli
     

02 Jun, 2017

2 commits

  • As of a86d8becc3f0 ("net: dsa: Factor bottom tag receive functions"),
    the rcv caller frees the original SKB in case or error.

    Be symmetric with that and make the xmit caller do the same.

    At the same time, fix the checkpatch NULL comparison check:

    CHECK: Comparison to NULL could be written "!nskb"
    #208: FILE: net/dsa/tag_trailer.c:35:
    + if (nskb == NULL)

    Signed-off-by: Vivien Didelot
    Reviewed-by: Florian Fainelli
    Signed-off-by: David S. Miller

    Vivien Didelot
     
  • function ksz_rcv can be made static as it does not need to be
    in global scope. Reformat arguments to make it checkpatch warning
    free too.

    Cleans up sparse warning: "symbol 'ksz_rcv' was not declared. Should
    it be static?"

    Signed-off-by: Colin Ian King
    Reviewed-by: Woojung Huh
    Signed-off-by: David S. Miller

    Colin Ian King
     

01 Jun, 2017

1 commit