16 Oct, 2016

1 commit

  • vmxnet3_set_mc() checks new_table_pa returned by dma_map_single()
    with dma_mapping_error(), but even there it assumes zero is invalid pa
    (it assumes dma_mapping_error(...,0) returns true if new_table is NULL).

    The patch adds an explicit variable to track status of new_table_pa.

    Found by Linux Driver Verification project (linuxtesting.org).

    v2: use "bool" and "true"/"false" for boolean variables.
    Signed-off-by: Alexey Khoroshilov
    Signed-off-by: David S. Miller

    Alexey Khoroshilov
     

04 Oct, 2016

1 commit

  • vmxnet3_reset_work() expects tx queues to be stopped (via
    vmxnet3_quiesce_dev -> netif_tx_disable). However, this races with the
    netif_wake_queue() call in netif_tx_timeout() such that the driver's
    start_xmit routine may be called unexpectedly, triggering one of the BUG_ON
    in vmxnet3_map_pkt with a stack trace like this:

    RIP: 0010:[] vmxnet3_map_pkt+0x3ac/0x4c0 [vmxnet3]
    [] vmxnet3_tq_xmit+0x210/0x4e0 [vmxnet3]
    [] dev_hard_start_xmit+0x2e4/0x4c0
    [] sch_direct_xmit+0x17e/0x1e0
    [] __qdisc_run+0xd7/0x130
    [] net_tx_action+0x10a/0x200
    [] __do_softirq+0x11f/0x260
    [] call_softirq+0x1c/0x30
    [] do_softirq+0x65/0xa0
    [] local_bh_enable_ip+0x99/0xa0
    [] destroy_conntrack+0x96/0x110 [nf_conntrack]
    [] nf_conntrack_destroy+0x12/0x20
    [] skb_release_head_state+0xb5/0xf0
    [] skb_release_all+0x9/0x20
    [] __kfree_skb+0x9/0x90
    [] vmxnet3_quiesce_dev+0x209/0x340 [vmxnet3]
    [] vmxnet3_reset_work+0x6a/0xa0 [vmxnet3]
    [] process_one_work+0x16c/0x350
    [] worker_thread+0x17a/0x410
    [] kthread+0x96/0xa0
    [] kernel_thread_helper+0x4/0x10

    Signed-off-by: Benjamin Poirier
    Signed-off-by: David S. Miller

    Benjamin Poirier
     

30 Aug, 2016

1 commit


26 Aug, 2016

1 commit

  • Fixes the following sparse warning:

    drivers/net/vmxnet3/vmxnet3_drv.c:1645:1: warning:
    symbol 'vmxnet3_rq_destroy_all_rxdataring' was not declared. Should it be static?

    Signed-off-by: Wei Yongjun
    Signed-off-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Wei Yongjun
     

20 Aug, 2016

1 commit

  • 'Commit 3c8b3efc061a ("vmxnet3: allow variable length transmit data ring
    buffer")' changed the size of the buffers in the tx data ring from a
    fixed size of 128 bytes to a variable size.

    However, while copying data to the data ring, vmxnet3_copy_hdr continues
    to carry the old code that assumes fixed buffer size of 128. This patch
    fixes it by adding correct offset based on the actual data ring buffer
    size.

    Signed-off-by: Guolin Yang
    Signed-off-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Shrikrishna Khare
     

17 Jun, 2016

7 commits

  • With all vmxnet3 version 3 changes incorporated in the vmxnet3 driver,
    the driver can configure emulation to run at vmxnet3 version 3, provided
    the emulation advertises support for version 3.

    Signed-off-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Shrikrishna Khare
     
  • In vmxnet3 version 3, the emulation added support for the vmxnet3 driver
    to communicate information about the memory regions the driver will use
    for rx/tx buffers. The driver can also indicate which rx/tx queue the
    memory region is applicable for. If this information is communicated
    to the emulation, the emulation will always keep these memory regions
    mapped, thereby avoiding the mapping/unmapping overhead for every packet.

    Currently, Linux vmxnet3 driver does not leverage this capability. The
    feasibility of using this approach for the Linux vmxnet3 driver will be
    investigated independently and if possible, will be part of a different
    patch. This patch only exposes the emulation capability to the driver
    (vmxnet3_defs.h is identical between the driver and the emulation).

    Signed-off-by: Guolin Yang
    Signed-off-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Shrikrishna Khare
     
  • The emulation supports a variety of coalescing modes viz. disabled
    (no coalescing), adaptive, static (number of packets to batch before
    raising an interrupt), rate based (number of interrupts per second).

    This patch implements get_coalesce and set_coalesce methods to allow
    querying and configuring different coalescing modes.

    Signed-off-by: Keyong Sun
    Signed-off-by: Manoj Tammali
    Signed-off-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Shrikrishna Khare
     
  • vmxnet3 driver preallocates buffers for receiving packets and posts the
    buffers to the emulation. In order to deliver a received packet to the
    guest, the emulation must map buffer(s) and copy the packet into it.

    To avoid this memory mapping overhead, this patch introduces the receive
    data ring - a set of small sized buffers that are always mapped by
    the emulation. If a packet fits into the receive data ring buffer, the
    emulation delivers the packet via the receive data ring (which must be
    copied by the guest driver), or else the usual receive path is used.

    Receive Data Ring buffer length is configurable via ethtool -G ethX rx-mini

    Signed-off-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Shrikrishna Khare
     
  • vmxnet3 driver supports transmit data ring viz. a set of fixed size
    buffers used by the driver to copy packet headers. Small packets that
    fit these buffers are copied into these buffers entirely.

    Currently this buffer size of fixed at 128 bytes. This patch extends
    transmit data ring implementation to allow variable length transmit
    data ring buffers. The length of the buffer is read from the emulation
    during initialization.

    Signed-off-by: Sriram Rangarajan
    Signed-off-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Shrikrishna Khare
     
  • Shared memory is used to exchange information between the vmxnet3 driver
    and the emulation. In order to request emulation to perform a task, the
    driver first populates specific fields in this shared memory and then
    issues corresponding command by writing to the command register(CMD). The
    layout of the shared memory was defined by vmxnet3 version 1 and cannot
    be extended for every new command without breaking backward compatibility.

    To address this problem, in vmxnet3 version 3, the emulation repurposed
    a reserved field in the shared memory to represent command information
    instead. For new commands, the driver first populates the command
    information field in the shared memory and then issues the command. The
    emulation interprets the data written to the command information depending
    on the type of the command. This patch exposes this capability to the driver.

    Signed-off-by: Guolin Yang
    Signed-off-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Shrikrishna Khare
     
  • vmxnet3 is currently at version 2, but some command definitions from
    previous vmxnet3 versions are missing. Add those definitions before
    moving to version 3.

    Also, introduce utility macros for vmxnet3 version comparison and update
    Copyright information and Maintained by.

    Signed-off-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Shrikrishna Khare
     

10 Jun, 2016

1 commit


22 Apr, 2016

1 commit


15 Mar, 2016

1 commit

  • A recent bug fix rearranged the code in vmxnet3_tq_xmit() in a
    way that left the error handling for oversized headers unlock
    a lock that had not been taken yet. Gcc warns about the incorrect
    use of the 'flags' variable because of that:

    drivers/net/vmxnet3/vmxnet3_drv.c: In function 'vmxnet3_tq_xmit.constprop':
    include/linux/spinlock.h:246:3: error: 'flags' may be used uninitialized in this function [-Werror=maybe-uninitialized]

    This changes the error handling path to 'goto' the end of the function
    beyond the lock/unlock pair.

    Signed-off-by: Arnd Bergmann
    Fixes: cec05562fb1d ("vmxnet3: avoid calling pskb_may_pull with interrupts disabled")
    Signed-off-by: David S. Miller

    Arnd Bergmann
     

08 Mar, 2016

1 commit

  • vmxnet3 has a function vmxnet3_parse_and_copy_hdr which, among other operations,
    uses pskb_may_pull to linearize the header portion of an skb. That operation
    eventually uses local_bh_disable/enable to ensure that it doesn't race with the
    drivers bottom half handler. Unfortunately, vmxnet3 preforms this
    parse_and_copy operation with a spinlock held and interrupts disabled. This
    causes us to run afoul of the WARN_ON_ONCE(irqs_disabled()) warning in
    local_bh_enable, resulting in this:

    WARNING: at kernel/softirq.c:159 local_bh_enable+0x59/0x90() (Not tainted)
    Hardware name: VMware Virtual Platform
    Modules linked in: ipv6 ppdev parport_pc parport microcode e1000 vmware_balloon
    vmxnet3 i2c_piix4 sg ext4 jbd2 mbcache sd_mod crc_t10dif sr_mod cdrom mptspi
    mptscsih mptbase scsi_transport_spi pata_acpi ata_generic ata_piix vmwgfx ttm
    drm_kms_helper drm i2c_core dm_mirror dm_region_hash dm_log dm_mod [last
    unloaded: mperf]
    Pid: 6229, comm: sshd Not tainted 2.6.32-616.el6.i686 #1
    Call Trace:
    [] ? warn_slowpath_common+0x89/0xe0
    [] ? local_bh_enable+0x59/0x90
    [] ? warn_slowpath_null+0x1b/0x20
    [] ? local_bh_enable+0x59/0x90
    [] ? skb_copy_bits+0x126/0x210
    [] ? ext4_ext_find_extent+0x24e/0x2d0 [ext4]
    [] ? __pskb_pull_tail+0x6e/0x2b0
    [] ? vmxnet3_xmit_frame+0xba4/0xef0 [vmxnet3]
    [] ? selinux_ip_postroute+0x56/0x320
    [] ? cfq_add_rq_rb+0x98/0x110
    [] ? packet_rcv+0x48/0x350
    [] ? dev_queue_xmit_nit+0xc9/0x140
    ...

    Fix it by splitting vmxnet3_parse_and_copy_hdr into two functions:

    vmxnet3_parse_hdr, which sets up the internal/on stack ctx datastructure, and
    pulls the skb (both of which can be done without holding the spinlock with irqs
    disabled

    and

    vmxnet3_copy_header, which just copies the skb to the tx ring under the lock
    safely.

    tested and shown to correct the described problem. Applies cleanly to the head
    of the net tree

    Signed-off-by: Neil Horman
    CC: Shrikrishna Khare
    CC: "VMware, Inc."
    CC: "David S. Miller"
    Acked-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Neil Horman
     

22 Feb, 2016

1 commit


07 Jan, 2016

1 commit


02 Dec, 2015

1 commit

  • vmxnet3_drv does not check dma_addr with dma_mapping_error()
    after mapping dma memory. The patch adds the checks and
    tries to handle failures.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Alexey Khoroshilov
    Acked-by: Shrikrishna Khare
    Signed-off-by: David S. Miller

    Alexey Khoroshilov
     

17 Nov, 2015

1 commit


16 Oct, 2015

1 commit


24 Sep, 2015

1 commit


09 Jul, 2015

1 commit

  • vmxnet3's current napi path is built to count every rx descriptor we recieve,
    and use that as a count of the napi budget. That means its possible to return
    from a napi poll halfway through recieving a fragmented packet accross multiple
    dma descriptors. If that happens, the next napi poll will start with the
    descriptor ring in an improper state (e.g. the first descriptor we look at may
    have the end-of-packet bit set), which will cause a BUG halt in the driver.

    Fix the issue by only counting whole received packets in the napi poll and
    returning that value, rather than the descriptor count.

    Tested by the reporter and myself, successfully

    Signed-off-by: Neil Horman
    CC: Shreyas Bhatewara
    CC: "David S. Miller"
    Acked-by: Andy Gospodarek
    Signed-off-by: David S. Miller

    Neil Horman
     

30 Jun, 2015

1 commit


23 Jun, 2015

3 commits


02 Apr, 2015

1 commit


02 Mar, 2015

1 commit


09 Feb, 2015

1 commit


16 Jan, 2015

1 commit


14 Jan, 2015

1 commit


13 Jan, 2015

1 commit


07 Jan, 2015

1 commit


09 Dec, 2014

1 commit

  • This patch extends the set/get_rxfh ethtool-options for getting or
    setting the RSS hash function.

    It modifies drivers implementation of set/get_rxfh accordingly.

    This change also delegates the responsibility of checking whether a
    modification to a certain RX flow hash parameter is supported to the
    driver implementation of set_rxfh.

    User-kernel API is done through the new hfunc bitmask field in the
    ethtool_rxfh struct. A bit set in the hfunc field is corresponding to an
    index in the new string-set ETH_SS_RSS_HASH_FUNCS.

    Got approval from most of the relevant driver maintainers that their
    driver is using Toeplitz, and for the few that didn't answered, also
    assumed it is Toeplitz.

    Cc: Tom Lendacky
    Cc: Ariel Elior
    Cc: Prashant Sreedharan
    Cc: Michael Chan
    Cc: Hariprasad S
    Cc: Sathya Perla
    Cc: Subbu Seetharaman
    Cc: Ajit Khaparde
    Cc: Jeff Kirsher
    Cc: Jesse Brandeburg
    Cc: Bruce Allan
    Cc: Carolyn Wyborny
    Cc: Don Skidmore
    Cc: Greg Rose
    Cc: Matthew Vick
    Cc: John Ronciak
    Cc: Mitch Williams
    Cc: Amir Vadai
    Cc: Solarflare linux maintainers
    Cc: Shradha Shah
    Cc: Shreyas Bhatewara
    Cc: "VMware, Inc."
    Cc: Ben Hutchings
    Signed-off-by: Eyal Perry
    Signed-off-by: Amir Vadai
    Signed-off-by: David S. Miller

    Eyal Perry
     

17 Nov, 2014

1 commit


10 Oct, 2014

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "The interesting things here are:

    - Turn on Config Request Retry Status Software Visibility. This
    caused hangs last time, but we included a fix this time.
    - Rework PCI device configuration to use _HPP/_HPX more aggressively
    - Allow PCI devices to be put into D3cold during system suspend
    - Add arm64 PCI support
    - Add APM X-Gene host bridge driver
    - Add TI Keystone host bridge driver
    - Add Xilinx AXI host bridge driver

    More detailed summary:

    Enumeration
    - Check Vendor ID only for Config Request Retry Status (Rajat Jain)
    - Enable Config Request Retry Status when supported (Rajat Jain)
    - Add generic domain handling (Catalin Marinas)
    - Generate uppercase hex for modalias interface class (Ricardo Ribalda Delgado)

    Resource management
    - Add missing MEM_64 mask in pci_assign_unassigned_bridge_resources() (Yinghai Lu)
    - Increase IBM ipr SAS Crocodile BARs to at least system page size (Douglas Lehr)

    PCI device hotplug
    - Prevent NULL dereference during pciehp probe (Andreas Noever)
    - Move _HPP & _HPX handling into core (Bjorn Helgaas)
    - Apply _HPP to PCIe devices as well as PCI (Bjorn Helgaas)
    - Apply _HPP/_HPX to display devices (Bjorn Helgaas)
    - Preserve SERR & PARITY settings when applying _HPP/_HPX (Bjorn Helgaas)
    - Preserve MPS and MRRS settings when applying _HPP/_HPX (Bjorn Helgaas)
    - Apply _HPP/_HPX to all devices, not just hot-added ones (Bjorn Helgaas)
    - Fix wait time in pciehp timeout message (Yinghai Lu)
    - Add more pciehp Slot Control debug output (Yinghai Lu)
    - Stop disabling pciehp notifications during init (Yinghai Lu)

    MSI
    - Remove arch_msi_check_device() (Alexander Gordeev)
    - Rename pci_msi_check_device() to pci_msi_supported() (Alexander Gordeev)
    - Move D0 check into pci_msi_check_device() (Alexander Gordeev)
    - Remove unused kobject from struct msi_desc (Yijing Wang)
    - Remove "pos" from the struct msi_desc msi_attrib (Yijing Wang)
    - Add "msi_bus" sysfs MSI/MSI-X control for endpoints (Yijing Wang)
    - Use __get_cached_msi_msg() instead of get_cached_msi_msg() (Yijing Wang)
    - Use __read_msi_msg() instead of read_msi_msg() (Yijing Wang)
    - Use __write_msi_msg() instead of write_msi_msg() (Yijing Wang)

    Power management
    - Drop unused runtime PM support code for PCIe ports (Rafael J. Wysocki)
    - Allow PCI devices to be put into D3cold during system suspend (Rafael J. Wysocki)

    AER
    - Add additional AER error strings (Gong Chen)
    - Make standalone includable (Thierry Reding)

    Virtualization
    - Add ACS quirk for Solarflare SFC9120 & SFC9140 (Alex Williamson)
    - Add ACS quirk for Intel 10G NICs (Alex Williamson)
    - Add ACS quirk for AMD A88X southbridge (Marti Raudsepp)
    - Remove unused pci_find_upstream_pcie_bridge(), pci_get_dma_source() (Alex Williamson)
    - Add device flag helpers (Ethan Zhao)
    - Assume all Mellanox devices have broken INTx masking (Gavin Shan)

    Generic host bridge driver
    - Fix ioport_map() for !CONFIG_GENERIC_IOMAP (Liviu Dudau)
    - Add pci_register_io_range() and pci_pio_to_address() (Liviu Dudau)
    - Define PCI_IOBASE as the base of virtual PCI IO space (Liviu Dudau)
    - Fix the conversion of IO ranges into IO resources (Liviu Dudau)
    - Add pci_get_new_domain_nr() and of_get_pci_domain_nr() (Liviu Dudau)
    - Add support for parsing PCI host bridge resources from DT (Liviu Dudau)
    - Add pci_remap_iospace() to map bus I/O resources (Liviu Dudau)
    - Add arm64 architectural support for PCI (Liviu Dudau)

    APM X-Gene
    - Add APM X-Gene PCIe driver (Tanmay Inamdar)
    - Add arm64 DT APM X-Gene PCIe device tree nodes (Tanmay Inamdar)

    Freescale i.MX6
    - Probe in module_init(), not fs_initcall() (Lucas Stach)
    - Delay enabling reference clock for SS until it stabilizes (Tim Harvey)

    Marvell MVEBU
    - Fix uninitialized variable in mvebu_get_tgt_attr() (Thomas Petazzoni)

    NVIDIA Tegra
    - Make sure the PCIe PLL is really reset (Eric Yuen)
    - Add error path tegra_msi_teardown_irq() cleanup (Jisheng Zhang)
    - Fix extended configuration space mapping (Peter Daifuku)
    - Implement resource hierarchy (Thierry Reding)
    - Clear CLKREQ# enable on port disable (Thierry Reding)
    - Add Tegra124 support (Thierry Reding)

    ST Microelectronics SPEAr13xx
    - Pass config resource through reg property (Pratyush Anand)

    Synopsys DesignWare
    - Use NULL instead of false (Fabio Estevam)
    - Parse bus-range property from devicetree (Lucas Stach)
    - Use pci_create_root_bus() instead of pci_scan_root_bus() (Lucas Stach)
    - Remove pci_assign_unassigned_resources() (Lucas Stach)
    - Check private_data validity in single place (Lucas Stach)
    - Setup and clear exactly one MSI at a time (Lucas Stach)
    - Remove open-coded bitmap operations (Lucas Stach)
    - Fix configuration base address when using 'reg' (Minghuan Lian)
    - Fix IO resource end address calculation (Minghuan Lian)
    - Rename get_msi_data() to get_msi_addr() (Minghuan Lian)
    - Add get_msi_data() to pcie_host_ops (Minghuan Lian)
    - Add support for v3.65 hardware (Murali Karicheri)
    - Fold struct pcie_port_info into struct pcie_port (Pratyush Anand)

    TI Keystone
    - Add TI Keystone PCIe driver (Murali Karicheri)
    - Limit MRSS for all downstream devices (Murali Karicheri)
    - Assume controller is already in RC mode (Murali Karicheri)
    - Set device ID based on SoC to support multiple ports (Murali Karicheri)

    Xilinx AXI
    - Add Xilinx AXI PCIe driver (Srikanth Thokala)
    - Fix xilinx_pcie_assign_msi() return value test (Dan Carpenter)

    Miscellaneous
    - Clean up whitespace (Quentin Lambert)
    - Remove assignments from "if" conditions (Quentin Lambert)
    - Move PCI_VENDOR_ID_VMWARE to pci_ids.h (Francesco Ruggeri)
    - x86: Mark DMI tables as initialization data (Mathias Krause)
    - x86: Move __init annotation to the correct place (Mathias Krause)
    - x86: Mark constants of pci_mmcfg_nvidia_mcp55() as __initconst (Mathias Krause)
    - x86: Constify pci_mmcfg_probes[] array (Mathias Krause)
    - x86: Mark PCI BIOS initialization code as such (Mathias Krause)
    - Parenthesize PCI_DEVID and PCI_VPD_LRDT_ID parameters (Megan Kamiya)
    - Remove unnecessary variable in pci_add_dynid() (Tobias Klauser)"

    * tag 'pci-v3.18-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (109 commits)
    arm64: dts: Add APM X-Gene PCIe device tree nodes
    PCI: Add ACS quirk for AMD A88X southbridge devices
    PCI: xgene: Add APM X-Gene PCIe driver
    PCI: designware: Remove open-coded bitmap operations
    PCI/MSI: Remove unnecessary temporary variable
    PCI/MSI: Use __write_msi_msg() instead of write_msi_msg()
    MSI/powerpc: Use __read_msi_msg() instead of read_msi_msg()
    PCI/MSI: Use __get_cached_msi_msg() instead of get_cached_msi_msg()
    PCI/MSI: Add "msi_bus" sysfs MSI/MSI-X control for endpoints
    PCI/MSI: Remove "pos" from the struct msi_desc msi_attrib
    PCI/MSI: Remove unused kobject from struct msi_desc
    PCI/MSI: Rename pci_msi_check_device() to pci_msi_supported()
    PCI/MSI: Move D0 check into pci_msi_check_device()
    PCI/MSI: Remove arch_msi_check_device()
    irqchip: armada-370-xp: Remove arch_msi_check_device()
    PCI/MSI/PPC: Remove arch_msi_check_device()
    arm64: Add architectural support for PCI
    PCI: Add pci_remap_iospace() to map bus I/O resources
    of/pci: Add support for parsing PCI host bridge resources from DT
    of/pci: Add pci_get_new_domain_nr() and of_get_pci_domain_nr()
    ...

    Conflicts:
    arch/arm64/boot/dts/apm-storm.dtsi

    Linus Torvalds
     

25 Sep, 2014

1 commit

  • Move PCI_VENDOR_ID_VMWARE from device-specific files to pci_ids.h.
    It is useful to always have access to it, especially when accessing
    subsystem_vendor_id on emulated devices.

    [bhelgaas: keep pci_ids.h sorted and use lower-case hex]
    Signed-off-by: Francesco Ruggeri
    Signed-off-by: Bjorn Helgaas

    Francesco Ruggeri
     

06 Sep, 2014

1 commit


13 Aug, 2014

1 commit

  • We should prefer `struct pci_device_id` over `DEFINE_PCI_DEVICE_TABLE` to
    meet kernel coding style guidelines. This issue was reported by checkpatch.

    A simplified version of the semantic patch that makes this change is as
    follows (http://coccinelle.lip6.fr/):

    //

    @@
    identifier i;
    declarer name DEFINE_PCI_DEVICE_TABLE;
    initializer z;
    @@

    - DEFINE_PCI_DEVICE_TABLE(i)
    + const struct pci_device_id i[]
    = z;

    //

    [bhelgaas: add semantic patch]
    Signed-off-by: Benoit Taine
    Signed-off-by: Bjorn Helgaas

    Benoit Taine