| 1 | /* |
| 2 | * Copyright 2008-2018 Cisco Systems, Inc. All rights reserved. |
| 3 | * Copyright 2007 Nuova Systems, Inc. All rights reserved. |
| 4 | * |
| 5 | * LICENSE_BEGIN |
| 6 | * |
| 7 | * This software is available to you under a choice of one of two |
| 8 | * licenses. You may choose to be licensed under the terms of the GNU |
| 9 | * General Public License (GPL) Version 2, available from the file |
| 10 | * COPYING in the main directory of this source tree, or the |
| 11 | * BSD license below: |
| 12 | * |
| 13 | * Redistribution and use in source and binary forms, with or |
| 14 | * without modification, are permitted provided that the following |
| 15 | * conditions are met: |
| 16 | * |
| 17 | * - Redistributions of source code must retain the above |
| 18 | * copyright notice, this list of conditions and the following |
| 19 | * disclaimer. |
| 20 | * |
| 21 | * - Redistributions in binary form must reproduce the above |
| 22 | * copyright notice, this list of conditions and the following |
| 23 | * disclaimer in the documentation and/or other materials |
| 24 | * provided with the distribution. |
| 25 | * |
| 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 27 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 28 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 29 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 30 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 31 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 32 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 33 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 34 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 36 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 37 | * POSSIBILITY OF SUCH DAMAGE. |
| 38 | * |
| 39 | * LICENSE_END |
| 40 | * |
| 41 | * |
| 42 | */ |
| 43 | |
| 44 | #include <linux/kernel.h> |
| 45 | #include <linux/errno.h> |
| 46 | #include <linux/types.h> |
| 47 | #include <linux/pci.h> |
| 48 | #include <linux/delay.h>cxx . . $ `<file>/prov/usnic/src/usnic_direct/linux/delay.h`/ |
| 49 | |
| 50 | #include "kcompat.h"cxx . . $ `<file>/prov/usnic/src/usnic_direct/kcompat.h`/ |
| 51 | #include "vnic_dev.h"cxx . . $ `<file>/prov/usnic/src/usnic_direct/vnic_dev.h`/ |
| 52 | #include "vnic_intr.h"cxx . . $ `<file>/prov/usnic/src/usnic_direct/vnic_intr.h`/ |
| 53 | |
| 54 | EXPORT_SYMBOLcxx . . $ `prov/usnic/src/usnic_direct/kcompat.h:58:9`!(vnic_intr_free); |
| 55 | void vnic_intr_freecxx . . $ vnic_intr_free(4ad2f8eb92e2bbbb).(struct vnic_intrcxx . . $ vnic_intr# *intr) |
| 56 | { |
| 57 | intr->ctrlcxx . . $ vnic_intr#ctrl. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 58 | } |
| 59 | |
| 60 | EXPORT_SYMBOLcxx . . $ `prov/usnic/src/usnic_direct/kcompat.h:58:9`!(vnic_intr_alloc); |
| 61 | int vnic_intr_alloccxx . . $ vnic_intr_alloc(243b6ec9282afca3).(struct vnic_devcxx . . $ vnic_dev# *vdev, struct vnic_intrcxx . . $ vnic_intr# *intr, |
| 62 | unsigned int index) |
| 63 | { |
| 64 | intr->indexcxx . . $ vnic_intr#index. = index; |
| 65 | intr->vdevcxx . . $ vnic_intr#vdev. = vdev; |
| 66 | |
| 67 | intr->ctrlcxx . . $ vnic_intr#ctrl. = vnic_dev_get_rescxx . . $ vnic_dev_get_res(5acd67ed2f089690).(vdev, RES_TYPE_INTR_CTRLcxx . . $ RES_TYPE_INTR_CTRL., index); |
| 68 | if (!intr->ctrlcxx . . $ vnic_intr#ctrl.) { |
| 69 | pr_errcxx . . $ `prov/usnic/src/usnic_direct/kcompat_priv.h:84:9`!("Failed to hook INTR[%d].ctrl resource\n", index); |
| 70 | return -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 71 | } |
| 72 | |
| 73 | return 0; |
| 74 | } |
| 75 | |
| 76 | EXPORT_SYMBOLcxx . . $ `prov/usnic/src/usnic_direct/kcompat.h:58:9`!(vnic_intr_init); |
| 77 | void vnic_intr_initcxx . . $ vnic_intr_init(2c52ca34a4f1b4b8).(struct vnic_intrcxx . . $ vnic_intr# *intr, u32cxx . . $ u32# coalescing_timer, |
| 78 | unsigned int coalescing_type, unsigned int mask_on_assertion) |
| 79 | { |
| 80 | vnic_intr_coalescing_timer_setcxx . . $ vnic_intr_coalescing_timer_set(daf4b02cf9f2d6c4).(intr, coalescing_timer); |
| 81 | iowrite32cxx . . $ iowrite32(56cca040bbd65dce).(coalescing_type, &intr->ctrlcxx . . $ vnic_intr#ctrl.->coalescing_typecxx . . $ vnic_intr_ctrl#coalescing_type.); |
| 82 | iowrite32cxx . . $ iowrite32(56cca040bbd65dce).(mask_on_assertion, &intr->ctrlcxx . . $ vnic_intr#ctrl.->mask_on_assertioncxx . . $ vnic_intr_ctrl#mask_on_assertion.); |
| 83 | iowrite32cxx . . $ iowrite32(56cca040bbd65dce).(0, &intr->ctrlcxx . . $ vnic_intr#ctrl.->int_creditscxx . . $ vnic_intr_ctrl#int_credits.); |
| 84 | } |
| 85 | |
| 86 | void vnic_intr_coalescing_timer_setcxx . . $ vnic_intr_coalescing_timer_set(daf4b02cf9f2d6c4).(struct vnic_intrcxx . . $ vnic_intr# *intr, |
| 87 | u32cxx . . $ u32# coalescing_timer) |
| 88 | { |
| 89 | iowrite32cxx . . $ iowrite32(56cca040bbd65dce).(vnic_dev_intr_coal_timer_usec_to_hwcxx . . $ vnic_dev_intr_coal_timer_usec_to_hw(bbb8f5994ced69cb).(intr->vdevcxx . . $ vnic_intr#vdev., |
| 90 | coalescing_timer), &intr->ctrlcxx . . $ vnic_intr#ctrl.->coalescing_timercxx . . $ vnic_intr_ctrl#coalescing_timer.); |
| 91 | } |
| 92 | |
| 93 | void vnic_intr_cleancxx . . $ vnic_intr_clean(4ad2f8eb92e2bbbb).(struct vnic_intrcxx . . $ vnic_intr# *intr) |
| 94 | { |
| 95 | iowrite32cxx . . $ iowrite32(56cca040bbd65dce).(0, &intr->ctrlcxx . . $ vnic_intr#ctrl.->int_creditscxx . . $ vnic_intr_ctrl#int_credits.); |
| 96 | } |
| 97 | |
| 98 | void vnic_intr_raisecxx . . $ vnic_intr_raise(4ad2f8eb92e2bbbb).(struct vnic_intrcxx . . $ vnic_intr# *intr) |
| 99 | { |
| 100 | vnic_dev_raise_intrcxx . . $ vnic_dev_raise_intr(99d9c52b93adadb7).(intr->vdevcxx . . $ vnic_intr#vdev., (u16cxx . . $ u16#)intr->indexcxx . . $ vnic_intr#index.); |
| 101 | } |
| 102 | |
| 103 | EXPORT_SYMBOLcxx . . $ `prov/usnic/src/usnic_direct/kcompat.h:58:9`!(vnic_grpmbrintr_free); |
| 104 | void vnic_grpmbrintr_freecxx . . $ vnic_grpmbrintr_free(4ad2f8eb92e2bbbb).(struct vnic_intrcxx . . $ vnic_intr# *intr) |
| 105 | { |
| 106 | intr->ctrlcxx . . $ vnic_intr#ctrl. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 107 | } |
| 108 | |
| 109 | EXPORT_SYMBOLcxx . . $ `prov/usnic/src/usnic_direct/kcompat.h:58:9`!(vnic_grpmbrintr_alloc); |
| 110 | int vnic_grpmbrintr_alloccxx . . $ vnic_grpmbrintr_alloc(243b6ec9282afca3).(struct vnic_devcxx . . $ vnic_dev# *vdev, struct vnic_intrcxx . . $ vnic_intr# *intr, |
| 111 | unsigned int index) |
| 112 | { |
| 113 | intr->indexcxx . . $ vnic_intr#index. = index; |
| 114 | intr->vdevcxx . . $ vnic_intr#vdev. = vdev; |
| 115 | |
| 116 | intr->ctrlcxx . . $ vnic_intr#ctrl. = vnic_dev_get_rescxx . . $ vnic_dev_get_res(5acd67ed2f089690).(vdev, RES_TYPE_GRPMBR_INTRcxx . . $ RES_TYPE_GRPMBR_INTR., index); |
| 117 | if (!intr->ctrlcxx . . $ vnic_intr#ctrl.) { |
| 118 | pr_errcxx . . $ `prov/usnic/src/usnic_direct/kcompat_priv.h:84:9`!("Failed to hook INTR[%d].ctrl resource\n", index); |
| 119 | return -EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 120 | } |
| 121 | |
| 122 | return 0; |
| 123 | } |