1. 08 Jan, 2017 6 commits
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpsw: add support for ringparam configuration · be034fc1
      Grygorii Strashko authored
      The CPDMA uses one pool of descriptors for both RX and TX which by default
      split between all channels proportionally depending on total number of
      CPDMA channels and number of TX and RX channels. As result, more
      descriptors will be consumed by TX path if there are more TX channels and
      there is no way now to dedicate more descriptors for RX path.
      
      So, add the ability to re-split CPDMA pool of descriptors between RX and TX
      path via ethtool '-G' command wich will allow to configure and fix number
      of descriptors used by RX and TX path, which, then, will be split between
      RX/TX channels proportionally depending on RX/TX channels number and
      weight. ethtool '-G' command will accept only number of RX entries and rest
      of descriptors will be arranged for TX automatically.
      
      Command:
        ethtool -G <devname> rx <number of descriptors>
      
      defaults and limitations:
      - minimum number of rx descriptors is 10% of total number of descriptors in
        CPDMA pool
      - maximum number of rx descriptors is 90% of total number of descriptors in
        CPDMA pool
      - by default, descriptors will be split equally between RX/TX path
      - any values passed in "tx" parameter will be ignored
      
      Usage:
      
       # ethtool -g eth0
      	Pre-set maximums:
      	RX:             7372
      	RX Mini:        0
      	RX Jumbo:       0
      	TX:             0
      	Current hardware settings:
      	RX:             4096
      	RX Mini:        0
      	RX Jumbo:       0
      	TX:             4096
      
       # ethtool -G eth0 rx 7372
       # ethtool -g eth0
      	Ring parameters for eth0:
      	Pre-set maximums:
      	RX:             7372
      	RX Mini:        0
      	RX Jumbo:       0
      	TX:             0
      	Current hardware settings:
      	RX:             7372
      	RX Mini:        0
      	RX Jumbo:       0
      	TX:             820
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      be034fc1
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpsw: add support for descs pool size configuration · 90225bf0
      Grygorii Strashko authored
      The CPSW CPDMA can process buffer descriptors placed as in internal
      CPPI RAM as in DDR. This patch adds support in CPSW and CPDMA for
      descs_pool_size mudule parameter, which defines total number of CPDMA CPPI
      descriptors to be used for both ingress/egress packets processing:
       - memory size, required for CPDMA descriptor pool, is calculated basing
      on number of descriptors specified by user in descs_pool_size and
      CPDMA descriptor size and allocated from coherent memory (CMA area);
       - CPDMA descriptor pool will be allocated in DDR if pool memory size >
      internal CPPI RAM or use internal CPPI RAM otherwise;
       - if descs_pool_size not specified in DT - the default value 256 will
      be used which will allow to place CPDMA descriptors pool into the
      internal CPPI RAM (current default behaviour);
       - CPDMA will ignore descs_pool_size if descs_pool_size = 0 for
      backward comaptiobility with davinci_emac.
      
      descs_pool_size is boot time setting and can't be changed once
      CPSW/CPDMA is initialized.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      90225bf0
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpdma: use devm_ioremap · 7f3b490a
      Grygorii Strashko authored
      Use devm_ioremap() and simplify the code.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7f3b490a
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpdma: minimize number of parameters in cpdma_desc_pool_create/destroy() · 5fcc40a9
      Grygorii Strashko authored
      Update cpdma_desc_pool_create/destroy() to accept only one parameter
      struct cpdma_ctlr*, as this structure contains all required
      information for pool creation/destruction.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5fcc40a9
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpdma: fix desc re-queuing · 12a303e3
      Grygorii Strashko authored
      The currently processing cpdma descriptor with EOQ flag set may
      contain two values in Next Descriptor Pointer field:
      - valid pointer: means CPDMA missed addition of new desc in queue;
      - null: no more descriptors in queue.
      In the later case, it's not required to write to HDP register, but now
      CPDMA does it.
      
      Hence, add additional check for Next Descriptor Pointer != null in
      cpdma_chan_process() function before writing in HDP register.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      12a303e3
    • Grygorii Strashko's avatar
      net: ethernet: ti: cpdma: am437x: allow descs to be plased in ddr · a6c83ccf
      Grygorii Strashko authored
      It's observed that cpsw/cpdma is not working properly when CPPI
      descriptors are placed in DDR instead of internal CPPI RAM on am437x
      SoC:
      - rx/tx silently stops processing packets;
      - or - after boot it's working for sometime, but stuck once Network
      load is increased (ping is working, but iperf is not).
      (The same issue has not been reproduced on am335x and am57xx).
      
      It seems that write to HDP register processed faster by interconnect
      than writing of descriptor memory buffer in DDR, which is probably
      caused by store buffer / write buffer differences as these functions
      are implemented differently across devices. So, to fix this i come up
      with two minimal, required changes:
      
      1) all accesses to the channel register HDP/CP/RXFREE registers should
      be done using sync IO accessors readl()/writel(), because all previous
      memory writes writes have to be completed before starting channel
      (write to HDP) or completing desc processing.
      
      2) the change 1 only doesn't work on am437x and additional reading of
      desc's field is required right after the new descriptor was filled
      with data and before pointer on it will be stored in
      prev_desc->hw_next field or HDP register.
      
      In addition, to above changes this patch eliminates all relaxed ordering
      I/O accessors in this driver as suggested by David Miller to avoid such
      kind of issues in the future, but with one exception - relaxed IO accessors
      will still be used to fill desc in cpdma_chan_submit(), which is safe as
      there is read barrier at the end of write sequence, and because sync IO
      accessors usage here will affect on net performance.
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6c83ccf
  2. 07 Jan, 2017 9 commits
  3. 06 Jan, 2017 23 commits
  4. 05 Jan, 2017 2 commits
    • Sowmini Varadhan's avatar
      tools: psock_tpacket: block Rx until socket filter has been added and socket... · c1878f7a
      Sowmini Varadhan authored
      tools: psock_tpacket: block Rx until socket filter has been added and socket has been bound to loopback.
      
      Packets from any/all interfaces may be queued up on the PF_PACKET socket
      before it is bound to the loopback interface by psock_tpacket, and
      when these are passed up by the kernel, they could interfere
      with the Rx tests.
      
      Avoid interference from spurious packet by blocking Rx until the
      socket filter has been set up, and the packet has been bound to the
      desired (lo) interface. The effective sequence is
      	socket(PF_PACKET, SOCK_RAW, 0);
      	set up ring
      	Invoke SO_ATTACH_FILTER
      	bind to sll_protocol set to ETH_P_ALL, sll_ifindex for lo
      After this sequence, the only packets that will be passed up are
      those received on loopback that pass the attached filter.
      Signed-off-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c1878f7a
    • Soheil Hassas Yeganeh's avatar
      tcp: provide timestamps for partial writes · ad02c4f5
      Soheil Hassas Yeganeh authored
      For TCP sockets, TX timestamps are only captured when the user data
      is successfully and fully written to the socket. In many cases,
      however, TCP writes can be partial for which no timestamp is
      collected.
      
      Collect timestamps whenever any user data is (fully or partially)
      copied into the socket. Pass tcp_write_queue_tail to tcp_tx_timestamp
      instead of the local skb pointer since it can be set to NULL on
      the error path.
      
      Note that tcp_write_queue_tail can be NULL, even if bytes have been
      copied to the socket. This is because acknowledgements are being
      processed in tcp_sendmsg(), and by the time tcp_tx_timestamp is
      called tcp_write_queue_tail can be NULL. For such cases, this patch
      does not collect any timestamps (i.e., it is best-effort).
      
      This patch is written with suggestions from Willem de Bruijn and
      Eric Dumazet.
      
      Change-log V1 -> V2:
      	- Use sockc.tsflags instead of sk->sk_tsflags.
      	- Use the same code path for normal writes and errors.
      Signed-off-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Acked-by: default avatarYuchung Cheng <ycheng@google.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Neal Cardwell <ncardwell@google.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ad02c4f5