10194621bSDennis Dalessandro #ifndef DEF_RDMAVT_H 20194621bSDennis Dalessandro #define DEF_RDMAVT_H 30194621bSDennis Dalessandro 40194621bSDennis Dalessandro /* 5fe314195SDennis Dalessandro * Copyright(c) 2016 Intel Corporation. 60194621bSDennis Dalessandro * 70194621bSDennis Dalessandro * This file is provided under a dual BSD/GPLv2 license. When using or 80194621bSDennis Dalessandro * redistributing this file, you may do so under either license. 90194621bSDennis Dalessandro * 100194621bSDennis Dalessandro * GPL LICENSE SUMMARY 110194621bSDennis Dalessandro * 120194621bSDennis Dalessandro * This program is free software; you can redistribute it and/or modify 130194621bSDennis Dalessandro * it under the terms of version 2 of the GNU General Public License as 140194621bSDennis Dalessandro * published by the Free Software Foundation. 150194621bSDennis Dalessandro * 160194621bSDennis Dalessandro * This program is distributed in the hope that it will be useful, but 170194621bSDennis Dalessandro * WITHOUT ANY WARRANTY; without even the implied warranty of 180194621bSDennis Dalessandro * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 190194621bSDennis Dalessandro * General Public License for more details. 200194621bSDennis Dalessandro * 210194621bSDennis Dalessandro * BSD LICENSE 220194621bSDennis Dalessandro * 230194621bSDennis Dalessandro * Redistribution and use in source and binary forms, with or without 240194621bSDennis Dalessandro * modification, are permitted provided that the following conditions 250194621bSDennis Dalessandro * are met: 260194621bSDennis Dalessandro * 270194621bSDennis Dalessandro * - Redistributions of source code must retain the above copyright 280194621bSDennis Dalessandro * notice, this list of conditions and the following disclaimer. 290194621bSDennis Dalessandro * - Redistributions in binary form must reproduce the above copyright 300194621bSDennis Dalessandro * notice, this list of conditions and the following disclaimer in 310194621bSDennis Dalessandro * the documentation and/or other materials provided with the 320194621bSDennis Dalessandro * distribution. 330194621bSDennis Dalessandro * - Neither the name of Intel Corporation nor the names of its 340194621bSDennis Dalessandro * contributors may be used to endorse or promote products derived 350194621bSDennis Dalessandro * from this software without specific prior written permission. 360194621bSDennis Dalessandro * 370194621bSDennis Dalessandro * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 380194621bSDennis Dalessandro * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 390194621bSDennis Dalessandro * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 400194621bSDennis Dalessandro * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 410194621bSDennis Dalessandro * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 420194621bSDennis Dalessandro * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 430194621bSDennis Dalessandro * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 440194621bSDennis Dalessandro * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 450194621bSDennis Dalessandro * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 460194621bSDennis Dalessandro * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 470194621bSDennis Dalessandro * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 480194621bSDennis Dalessandro * 490194621bSDennis Dalessandro */ 500194621bSDennis Dalessandro 510194621bSDennis Dalessandro #include <rdma/rdma_vt.h> 52b534875dSDennis Dalessandro #include <linux/pci.h> 53c1b332bcSDennis Dalessandro #include "dma.h" 548afd32ebSDennis Dalessandro #include "pd.h" 55b518d3e6SDennis Dalessandro #include "qp.h" 564c1e4972SDennis Dalessandro #include "ah.h" 572a055eb7SDennis Dalessandro #include "mr.h" 58aad9158bSDennis Dalessandro #include "srq.h" 599fa25171SDennis Dalessandro #include "mcast.h" 60dc21752eSDennis Dalessandro #include "mmap.h" 61cf16335aSDennis Dalessandro #include "cq.h" 623711baf2SDennis Dalessandro #include "mad.h" 630194621bSDennis Dalessandro 64b534875dSDennis Dalessandro #define rvt_pr_info(rdi, fmt, ...) \ 65b534875dSDennis Dalessandro __rvt_pr_info(rdi->driver_f.get_pci_dev(rdi), \ 66b534875dSDennis Dalessandro rdi->driver_f.get_card_name(rdi), \ 67b534875dSDennis Dalessandro fmt, \ 68b534875dSDennis Dalessandro ##__VA_ARGS__) 69b534875dSDennis Dalessandro 70b534875dSDennis Dalessandro #define rvt_pr_warn(rdi, fmt, ...) \ 71b534875dSDennis Dalessandro __rvt_pr_warn(rdi->driver_f.get_pci_dev(rdi), \ 72b534875dSDennis Dalessandro rdi->driver_f.get_card_name(rdi), \ 73b534875dSDennis Dalessandro fmt, \ 74b534875dSDennis Dalessandro ##__VA_ARGS__) 75b534875dSDennis Dalessandro 76b534875dSDennis Dalessandro #define rvt_pr_err(rdi, fmt, ...) \ 77b534875dSDennis Dalessandro __rvt_pr_err(rdi->driver_f.get_pci_dev(rdi), \ 78b534875dSDennis Dalessandro rdi->driver_f.get_card_name(rdi), \ 79b534875dSDennis Dalessandro fmt, \ 80b534875dSDennis Dalessandro ##__VA_ARGS__) 81b534875dSDennis Dalessandro 82b534875dSDennis Dalessandro #define __rvt_pr_info(pdev, name, fmt, ...) \ 83b534875dSDennis Dalessandro dev_info(&pdev->dev, "%s: " fmt, name, ##__VA_ARGS__) 84b534875dSDennis Dalessandro 85b534875dSDennis Dalessandro #define __rvt_pr_warn(pdev, name, fmt, ...) \ 86b534875dSDennis Dalessandro dev_warn(&pdev->dev, "%s: " fmt, name, ##__VA_ARGS__) 87b534875dSDennis Dalessandro 88b534875dSDennis Dalessandro #define __rvt_pr_err(pdev, name, fmt, ...) \ 89b534875dSDennis Dalessandro dev_err(&pdev->dev, "%s: " fmt, name, ##__VA_ARGS__) 90b534875dSDennis Dalessandro 91*f1badc71SDennis Dalessandro static inline int ibport_num_to_idx(struct ib_device *ibdev, u8 port_num) 92*f1badc71SDennis Dalessandro { 93*f1badc71SDennis Dalessandro struct rvt_dev_info *rdi = ib_to_rvt(ibdev); 94*f1badc71SDennis Dalessandro int port_index; 95*f1badc71SDennis Dalessandro 96*f1badc71SDennis Dalessandro port_index = port_num - 1; /* IB ports start at 1 our arrays at 0 */ 97*f1badc71SDennis Dalessandro if ((port_index < 0) || (port_index >= rdi->dparms.nports)) 98*f1badc71SDennis Dalessandro return -EINVAL; 99*f1badc71SDennis Dalessandro 100*f1badc71SDennis Dalessandro return port_index; 101*f1badc71SDennis Dalessandro } 102*f1badc71SDennis Dalessandro 1030194621bSDennis Dalessandro #endif /* DEF_RDMAVT_H */ 104