aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/vnic
Commit message (Collapse)AuthorAgeFilesLines
* vnic: correct and simplify SIOCSIFFLAGSEd Maste2019-09-011-6/+6
| | | | | | | | | PR: 223573, 223575 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13028 Notes: svn path=/head/; revision=351664
* vnic: avoid NULL deref in error caseEd Maste2019-08-291-3/+2
| | | | | | | | | Reported by: Dr Silvio Cesare of InfoSect MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351603
* Fix vnic fallback PHY name matching after r334880.Mark Johnston2018-07-141-1/+2
| | | | | | | | | | | | | | In some cases it seems that the PHY mode can only be identified by matching against the corresponding device node name in the FDT. r334880 broke this for the case where the node name contains a unit address. Fix the problem by allowing a match in that case. Reviewed by: andrew, sbruno Tested by: sbruno Differential Revision: https://reviews.freebsd.org/D16259 Notes: svn path=/head/; revision=336281
* In the ThunderX BGX network driver we were skipping the NULL terminatorAndrew Turner2018-06-091-16/+16
| | | | | | | | | | | | when parsing the phy type, however this is included in the length returned by OF_getprop. To fix this stop ignoring the terminator. PR: 228828 Reported by: sbruno Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=334880
* Align OF_getencprop_alloc API with OF_getencprop and OF_getprop_allocOleksandr Tymoshenko2018-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | Change OF_getencprop_alloc semantics to be combination of malloc and OF_getencprop and return size of the property, not number of elements allocated. For the use cases where number of elements is preferred introduce OF_getencprop_alloc_multi helper function that copies semantics of OF_getencprop_alloc prior to this change. This is to make OF_getencprop_alloc and OF_getencprop_alloc_multi function signatures consistent with OF_getencprop_alloc and OF_getencprop_alloc_multi. Functionality-wise this patch is mostly rename of OF_getencprop_alloc to OF_getencprop_alloc_multi except two calls in ofw_bus_setup_iinfo where 1 was used as a block size. Notes: svn path=/head/; revision=332341
* Clean up OF_getprop_alloc APIOleksandr Tymoshenko2018-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | OF_getprop_alloc takes element size argument and returns number of elements in the property. There are valid use cases for such behavior but mostly API consumers pass 1 as element size to get string properties. What API users would expect from OF_getprop_alloc is to be a combination of malloc + OF_getprop with the same semantic of return value. This patch modifies API signature to match these expectations. For the valid use cases with element size != 1 and to reduce modification scope new OF_getprop_alloc_multi function has been introduced that behaves the same way OF_getprop_alloc behaved prior to this patch. Reviewed by: ian, manu Differential Revision: https://reviews.freebsd.org/D14850 Notes: svn path=/head/; revision=332310
* [ofw] fix errneous checks for OF_finddevice(9) return valueOleksandr Tymoshenko2018-03-201-1/+1
| | | | | | | | | | | | | | | OF_finddevices returns ((phandle_t)-1) in case of failure. Some code in existing drivers checked return value to be equal to 0 or less/equal to 0 which is also wrong because phandle_t is unsigned type. Most of these checks were for negative cases that were never triggered so trhere was no impact on functionality. Reviewed by: nwhitehorn MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D14645 Notes: svn path=/head/; revision=331229
* Revert r327828, r327949, r327953, r328016-r328026, r328041:Pedro F. Giffuni2018-01-211-1/+1
| | | | | | | | | | | | | | | | | | Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 Notes: svn path=/head/; revision=328218
* dev: make some use of mallocarray(9).Pedro F. Giffuni2018-01-131-1/+1
| | | | | | | | | | | | | | Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. Notes: svn path=/head/; revision=327949
* Do pass removing some write-only variables from the kernel.Alexander Kabaev2017-12-253-7/+1
| | | | | | | | | | | | This reduces noise when kernel is compiled by newer GCC versions, such as one used by external toolchain ports. Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial) Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c) Differential Revision: https://reviews.freebsd.org/D10385 Notes: svn path=/head/; revision=327173
* vnic: apply hardware L3 checksum only for IPv4Ed Maste2017-12-051-3/+2
| | | | | | | | | | | | | | | Previously we set the csum_l3 flag for IPv4 and IPv6, but only IPv4 should have header checksumming applied. Prompted by Linux commit fa6d7cb5d76cf0467c61420fc9238045aedfd379. Reviewed by: bz MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13366 Notes: svn path=/head/; revision=326597
* Unbreak IPv6.Bjoern A. Zeeb2017-11-141-62/+71
| | | | | | | | | | | | | | | | No longer return ENXIO when trying to send an IPv6 packet in nicvf_sq_add_hdr_subdesc(). Restructure the code so that the upper layer protocol parts are agnostic of the L3 protocol (and no longer specific to IPv4). With this basic IPv6 packets go through. We are still seeing weird behaviour which needs further diagnosis. PR: 223669 In collaboration with: emaste MFC after: 3 days Notes: svn path=/head/; revision=325813
* vnic: report that the driver supports multicastEd Maste2017-11-141-1/+1
| | | | | | | | | | | | | The driver is currently hardcoded to force promiscuous mode, so all of the MAC filtering code is presently unused and multicast should "just work." Report to the higher layers that multicast is supported. PR: 223573 Reported by: bz Sponsored by: The FreeBSD Foundation, Packet.net (hardware) Notes: svn path=/head/; revision=325811
* vnic: apply BPF tap before passing packet to hardwareEd Maste2017-11-101-2/+3
| | | | | | | | | | | | | | Previously we passed tx packets to hardware via nicvf_tx_mbuf_locked and then to the BPF tap, with a possibly invalid mbuf which would result in a panic. PR: 223600 Discussed with: bz MFC after: 1 week Sponsored by: The FreeBSD Foundation, Packet.net (hardware) Notes: svn path=/head/; revision=325683
* Rework BGX detection to support both new and old firmwareZbigniew Bodek2017-03-311-33/+156
| | | | | | | | | | | | | Improve existing BGX detection and adjust it to support both new and older ThunderX firmwares. Match BGX FDT nodes by name and reg. Match PHY instances by qlm-mode and name. Tested on Firmware Version: 2016-09-30 09:12:11 Obtained from: Semihalf Differential Revision: https://reviews.freebsd.org/D9863 Notes: svn path=/head/; revision=316336
* Add the folowing set accessor functions for recently-added members of ifnetStephen J. Kiernan2017-01-311-14/+14
| | | | | | | | | | | | | | | | | | | structure: if_gethwtsomax(), if_sethwtsomax() - if_hw_tsomax if_gethwtsomaxsegcount(), if_sethwtsomaxsegcount() - if_hw_tsomaxsegcount if_gethwtsomaxsegsize(), if_sethwtsomaxsegsize() - if_hw_tsomaxsegsize Update em and vnic drivers which had already been coverted to use accessor functions for the other ifnet structure members. Reviewed by: erj Approved by: sjg (mentor) Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D8544 Notes: svn path=/head/; revision=313019
* INTRNG: Rework handling with resources. Partially revert r301453.Michal Meloun2016-08-192-4/+0
| | | | | | | | | | | | | | | | | | | | - Read interrupt properties at bus enumeration time and store it into global mapping table. - At bus_activate_resource() time, given mapping entry is resolved and connected to real interrupt source. A copy of mapping entry is attached to given resource. - At bus_setup_intr() time, mapping entry stored in resource is used for delivery of requested interrupt configuration. - For MSI/MSIX interrupts, mapping entry is created within pci_alloc_msi()/pci_alloc_msix() call. - For legacy PCI interrupts, mapping entry must be created within pcib_route_interrupt() by pcib driver itself. Reviewed by: nwhitehorn, andrew Differential Revision: https://reviews.freebsd.org/D7493 Notes: svn path=/head/; revision=304459
* INTRNG - change the way how an interrupt mapping data are providedSvatopluk Kraus2016-06-052-0/+4
| | | | | | | | | | | to the framework in OFW (FDT) case. This is a follow-up to r301451. Differential Revision: https://reviews.freebsd.org/D6634 Notes: svn path=/head/; revision=301453
* Fix VNIC module unloadingWojciech Macek2016-05-202-6/+26
| | | | | | | | | | | | Fix panics which were present when BGX and PF module were unloaded. Reviewed by: zbb Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6346 Notes: svn path=/head/; revision=300295
* Allow building VNIC as a moduleWojciech Macek2016-05-205-11/+17
| | | | | | | | | | | | | Add directory structure and fix dependencies to be able to build and use Cavium VNIC driver as a module. Reviewed by: zbb Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6345 Notes: svn path=/head/; revision=300294
* Add support for MTU chaning and Jumbo frames to VNICZbigniew Bodek2016-05-111-6/+24
| | | | | | | | | | | | Enable previously added code for MTU handling (based on Cavium 1.0 driver released on BSD license). This commit enables possibility to change MTU on VNIC driver. Obtained from: Semihalf Sponsored by: Cavium Notes: svn path=/head/; revision=299447
* Fix deadlock in VNIC when using single CPU onlyZbigniew Bodek2016-05-111-24/+9
| | | | | | | | | | | | | | Number of free Tx descriptors does not need to be locked since it can be modified atomically between SND and CQ tasks. It will also block Tx routine from sending packets while CQ will not be able to free descriptors. Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6266 Notes: svn path=/head/; revision=299446
* Add HW RSS support to VNIC driverZbigniew Bodek2016-05-114-2/+182
| | | | | | | | | | | | | | Based on v1.0 driver provided by Cavium under BSD license. Support in-hardware RSS to distribute IP, UDP and TCP traffic among available RX Queues and hence multiple CPUs. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6230 Notes: svn path=/head/; revision=299444
* Bind CQ interrupts and tasks to separate CPUs in VNICZbigniew Bodek2016-05-112-0/+16
| | | | | | | | | | | | | Delegate interrupts and completion tasks on separate CPUs for each VNIC. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D6229 Notes: svn path=/head/; revision=299443
* Fix sending TSO packets larger than single DMA segment on VNICZbigniew Bodek2016-04-081-7/+1
| | | | | | | | | | | | Due to the bug in the number of 'GATHER' subdescriptors for TSO packets, VNIC was not able to transmit more than one DMA segment with TSO enabled. Obtained from: Semihalf Sponsored by: Cavium Notes: svn path=/head/; revision=297721
* Speedup BGX link polling on ARM64Wojciech Macek2016-04-081-2/+2
| | | | | | | | | | | | | | | The previous values caused the callout thread stall for 100ms each 2s if no link is present. Dtrace analysis showed that it has significant impact on overall interrupt performance. Decrease these values by a factor of 100. Obtained from: Semihalf Sponsored by: Cavium Reviewed by: zbb Differential Revision: https://reviews.freebsd.org/D5854 Notes: svn path=/head/; revision=297707
* tcp/lro: Use tcp_lro_flush_all in device drivers to avoid code duplicationSepherosa Ziehau2016-04-011-5/+1
| | | | | | | | | | | | And factor out tcp_lro_rx_done, which deduplicates the same logic with netinet/tcp_lro.c Reviewed by: gallatin (1st version), hps, zbb, np, Dexuan Cui <decui microsoft com> Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5725 Notes: svn path=/head/; revision=297482
* Fix number of the enabled VFs in VNICZbigniew Bodek2016-03-311-14/+4
| | | | | | | | | | | | | | | | | | | nic->num_vf_en is set based on the number of the enabled LMACs. This number should not be overwritten later by any routine. Instead it should fail PCI_IOV_ADD_VF() so that available VFs with the corresponding LMACs will attach whereas other, disabled VFs will fail with the proper error code. Error signaling (due to improper number of VFs requested) is also moved from PCI_IOV_INIT() to PCI_IOV_ADD_VF(). This will be reworked when multiple queue sets are enabled but for now this is the correct behavior of the driver. Obtained from: Semihalf Sponsored by: Cavium Notes: svn path=/head/; revision=297457
* Don't omit m_dup() for non-writeable mbufs that need checksum calculationZbigniew Bodek2016-03-311-7/+8
| | | | | | | | | | | | | | | If the driver is not active or link is down the packet could remain non-writeable. This commit makes all mbufs enqueued to the driver's ring buffer to have correct attributes. Pointed out by: wma Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5800 Notes: svn path=/head/; revision=297453
* Fix MAC address configuration for VNICZbigniew Bodek2016-03-311-11/+11
| | | | | | | | | | | | | | | | | | | The FDT description is as follows: - phy-handle, reg, qlm-mode, mac-address are under nodes in bgx0/1 node - phy nodes (pointed by phy-handle) are under MDIO even though they may not be connected through to MDIO. In those nodes they do not contain MAC address or etc. This commit changes parsing of the FDT nodes for BGX so that it can obtain correct MAC address for a given PHY. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5781 Notes: svn path=/head/; revision=297451
* Improve TX path of the VNIC driverZbigniew Bodek2016-03-313-30/+78
| | | | | | | | | | | | | | | | | | | - Avoid memory leak when nicvf_tx_mbuf_locked() fails - Introduce nicvf_xmit_locked() routine that uses drbr_peek(), drbr_advance() or drbr_putback() for a specific ifnet. This gives more clear and efficient design as well as prevents from dropping mbufs that where not sent due to temporary lack of descriptors. - Add missing ETHER_BPF_MTAP() hook Pointed out by: yongari Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5534 Notes: svn path=/head/; revision=297450
* Fix typo in the VNIC's PF function nameZbigniew Bodek2016-03-311-3/+3
| | | | | | | Should be add_vf not addr_vf. Notes: svn path=/head/; revision=297448
* Improve HW checksums support in VNICZbigniew Bodek2016-03-291-9/+12
| | | | | | | | | | | | | | | | | - Do not mark CSUM_IP_CHECKED and CSUM_IP_VALID on IPv6 packets. IPv6 does not have checksums by definition. - Set SCTP packets csum_flags CSUM_SCTP_VALID instead of CSUM_DATA_VALID and skip csum_data - Set csum_data simply as 0xffff without byteswap Pointed out by: yongari Reviewed by: yongari, wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5537 Notes: svn path=/head/; revision=297389
* Don't manage free SQ entry index by the atomic operationsZbigniew Bodek2016-03-291-4/+3
| | | | | | | | | | | | It is not necessary as entries are being manipulated under lock. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5536 Notes: svn path=/head/; revision=297388
* Fix bug in VNIC causing phony number of available TX descriptorsZbigniew Bodek2016-03-101-1/+1
| | | | | | | | | | | | | | | | | | TSO packets will signal segments TX completion in the separate CQ descriptors. Each CQ descriptor for HW TSO will point to the same SQ entry. Do not invoke nicvf_put_sq_desc() for secondary segments to avoid free_cnt corruption and eventually integer overflow that will result in the negative free_cnt value and hence impossibility of further transmission. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5535 Notes: svn path=/head/; revision=296602
* Fix "received NULL mbuf" bug in VNICZbigniew Bodek2016-03-101-6/+1
| | | | | | | | | | | | | | | Do not modify NIC_QSET_CQ_0_7_HEAD manually, especially in non-atomic context. It doesn't seem to be necessary to recreate CQ head after interrupt clearing too. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5533 Notes: svn path=/head/; revision=296601
* Introduce HW TSO support for VNICZbigniew Bodek2016-02-255-54/+94
| | | | | | | | | | | | | This feature was added in Pass2.0. Significantly improves VNIC's TCP performance on Tx. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5424 Notes: svn path=/head/; revision=296039
* Enable CQ count threshold interrupt on VNIC Pass2.0Zbigniew Bodek2016-02-252-2/+2
| | | | | | | | | | | | On Pass2.0 can trigger interrupt on both timer and CQ count. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5423 Notes: svn path=/head/; revision=296038
* Fix VNIC support for Pass2.0 ThunderX chipsZbigniew Bodek2016-02-253-5/+24
| | | | | | | | | | | | | - Check chip revision using pass1_silicon() routine. - Configure CPI correctly for Pass2.0 Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5422 Notes: svn path=/head/; revision=296037
* Remove soft reset from the VNIC's PF driverZbigniew Bodek2016-02-251-3/+0
| | | | | | | | | | | | | This is not needed and causes revid register of the PCI configuration space to clear on Pass2.0. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5421 Notes: svn path=/head/; revision=296036
* Improve VNIC performance on Tx path by immediate packet transmissionZbigniew Bodek2016-02-253-3/+11
| | | | | | | | | | | | | Don't postpone Tx if the Tx lock can be acquired now. This gives 3x better performance on egress. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5325 Notes: svn path=/head/; revision=296035
* Clean-up network interface settings for VNICZbigniew Bodek2016-02-251-13/+10
| | | | | | | | | | | | | | - Remove unrelevant bits - Remove redundant code - Reset variables and then set given bits Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5324 Notes: svn path=/head/; revision=296034
* Enable HWSTATS capability for VNICZbigniew Bodek2016-02-251-0/+1
| | | | | | | | | | | | | VNIC manages counters in hardware hence it is desired to have this option enabled to avoid redundant stats update in ether_input_internal(). Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5323 Notes: svn path=/head/; revision=296033
* Prefetch next CQ descriptor in Completion Queue handling loop of VNICZbigniew Bodek2016-02-251-0/+2
| | | | | | | | | | Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5322 Notes: svn path=/head/; revision=296032
* Enable LRO support for VNIC driverZbigniew Bodek2016-02-253-0/+82
| | | | | | | | | | | | Support for software LRO when enabled in the capabilities Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5321 Notes: svn path=/head/; revision=296031
* Add support for hardware Tx and Rx checksums to VNIC driverZbigniew Bodek2016-02-252-7/+155
| | | | | | | | | | | | | | | | | | | | | - The network controller verifies Rx TCP/UDP/SCTP checksums by default. Communicate this to the stack when the packet is not marked as erroneous to avoid redundant checksum calculation in kernel. - It is not uncommon to get the mbuf with m_len that is less than the minimal size for the IP, TCP, UDP, etc. when HW checsumming is enabled. To avoid data corruption performed by the HW that is intended to write IP and TCP/UDP/SCTP checksums to the data segment, the mbuf needs to be pulled up by the required number of bytes. - Make sure that one can modify the mbufs that require checsum calculation rather than check for NULL mbuf on each transmission. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5320 Notes: svn path=/head/; revision=296030
* Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.Justin Hibbits2016-02-201-1/+1
| | | | | | | | | | | | | | This simplifies checking for default resource range for bus_alloc_resource(), and improves readability. This is part of, and related to, the migration of rman_res_t from u_long to uintmax_t. Discussed with: jhb Suggested by: marcel Notes: svn path=/head/; revision=295832
* Fix VNIC enumeration after r294993 and r294990Zbigniew Bodek2016-01-281-1/+1
| | | | | | | | | | | | | ofw_bus_get_node() must be tested against negative values since missing parent bus method will result in calling the default method which simply returns (-1): sys/dev/ofw/ofw_bus_if.m This was lost in the review process. Obtained from: Semihalf Sponsored by: Cavium Notes: svn path=/head/; revision=294998
* Support new MDIO hierarchy in ThunderX DTBZbigniew Bodek2016-01-283-5/+480
| | | | | | | | | | | | | | | | | Some firmware revisions provide different DTB tree that include odd MDIO placement in the tree. This commit adds support for 2 new buses: - MRML bridge (PCIB subordinate) - MDIO nexus (MRML subordinate) This allows for the correct MDIO attachment with both - new and old firmware. Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5070 Notes: svn path=/head/; revision=294994
* Fix finding appropriate BGX node in DTB and move it to a separate functionZbigniew Bodek2016-01-283-11/+143
| | | | | | | | | | | | | | | | | Search for BGX node in DTS in two ways: 1. Try to find it uder root node first 2. If not found under root, find the top level PCI bridge node and search all nodes below it until appropriate BGX node is found. Move search code to another function to make the code more clear. Remove unused variable by the way. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5066 Notes: svn path=/head/; revision=294990