From patchwork Fri Mar 24 10:45:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinpu Wang X-Patchwork-Id: 9642563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5C83760328 for ; Fri, 24 Mar 2017 10:47:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74A2226E81 for ; Fri, 24 Mar 2017 10:47:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 698B7283ED; Fri, 24 Mar 2017 10:47:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 015B927F07 for ; Fri, 24 Mar 2017 10:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756917AbdCXKrf (ORCPT ); Fri, 24 Mar 2017 06:47:35 -0400 Received: from mail-wr0-f171.google.com ([209.85.128.171]:33040 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751714AbdCXKre (ORCPT ); Fri, 24 Mar 2017 06:47:34 -0400 Received: by mail-wr0-f171.google.com with SMTP id y90so6760078wrb.0 for ; Fri, 24 Mar 2017 03:47:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ouyFtDYUWaUs+HiDFL0UO58HET4ZkmkG2Ejp35IMgfk=; b=Q6yttNUHz9uP3kZjbDexLdULbrIqG62FO1sNegJ/rv+c01cyyJDuVHTpFLWETAr3+q oa/MGA7h8tVlMhT6Fk7HcKuGo5VnhQxx8s4o+G4D0WO/GNWYTVPVmj0b5Q7Vhw8x82Pu SMCPluMq/SJa0XR6qDgvRdBgYnNuYN8psaq6qi2Ho5yyg5/HQaL0qwpZHYfJ0ek4bmKi QllGaDbvRLNtB81IbtkwYViJ46QFd/sKmFKAnQL4fLGf3g0pNcRZ/cVrnn3o64WMtISv S3h69268yYwS4Sgcwz2XcJsdEyI8R0FH6AsvdOhU//zJFo3q1D8loJGeIiUnye9F6YKW kQSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ouyFtDYUWaUs+HiDFL0UO58HET4ZkmkG2Ejp35IMgfk=; b=I6tpDmsmCNymAWqRzfa5m6Q1RiQrnZunGeJmlp9F453Y6mm0ICpyvwMe1zp0V2L9zA c8H22vzd3haoRTckU6KvUAfI6enRTchesCfn/ZGfdvZIBLgBzNkmSjW8hoy6gwt0Fiu/ 8iroUeJf5l9laA2DO9PuQRjG7vXAIwukT4KK4lI6dn4HVqoM48zQtmsVfThF2jDrzaH1 kRgU+QPpXn6vz/UFzWfzF+TkGhhO3PobgprOTIC7o80daKSSkTCc1FzeoXhRBwaVDz45 VNSwX5oF5iUzzfuFkBY4T/HFHIzJYY5V9tnaI6utf4+GsdKeuefGwnWkAKpt6dAZm4xl EqCQ== X-Gm-Message-State: AFeK/H0inaGo+7b8A0ZoR1AkAYtnXm05++5MVtUy+KK2qaRXRAL4K/W4Y8MV6ovMvS/1ZUnl X-Received: by 10.223.155.129 with SMTP id d1mr6953033wrc.67.1490352451977; Fri, 24 Mar 2017 03:47:31 -0700 (PDT) Received: from jinpu-GA-870A-USB3.pb.local ([62.217.45.26]) by smtp.gmail.com with ESMTPSA id s17sm2404458wrc.25.2017.03.24.03.47.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Mar 2017 03:47:31 -0700 (PDT) From: Jack Wang X-Google-Original-From: Jack Wang To: linux-block@vger.kernel.org, linux-rdma@vger.kernel.org Cc: dledford@redhat.com, axboe@kernel.dk, hch@lst.de, mail@fholler.de, Milind.dumbare@gmail.com, yun.wang@profitbricks.com, Jack Wang , Kleber Souza , Danil Kipnis , Roman Pen Subject: [PATCH 02/28] ibtrs: add header for log MICROs shared between ibtrs_client and ibtrs_server Date: Fri, 24 Mar 2017 11:45:17 +0100 Message-Id: <1490352343-20075-3-git-send-email-jinpu.wangl@profitbricks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490352343-20075-1-git-send-email-jinpu.wangl@profitbricks.com> References: <1490352343-20075-1-git-send-email-jinpu.wangl@profitbricks.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jack Wang Signed-off-by: Jack Wang Signed-off-by: Kleber Souza Signed-off-by: Danil Kipnis Signed-off-by: Roman Pen --- include/rdma/ibtrs_log.h | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 include/rdma/ibtrs_log.h diff --git a/include/rdma/ibtrs_log.h b/include/rdma/ibtrs_log.h new file mode 100644 index 0000000..28ff5b4 --- /dev/null +++ b/include/rdma/ibtrs_log.h @@ -0,0 +1,88 @@ +/* + * InfiniBand Transport Layer + * + * Copyright (c) 2014 - 2017 ProfitBricks GmbH. All rights reserved. + * Authors: Fabian Holler + * Jack Wang + * Kleber Souza + * Danil Kipnis + * Roman Pen + * Milind Dumbare + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + * + */ + +#ifndef __IBTRS_LOG_H__ +#define __IBTRS_LOG_H__ +#include "ibtrs.h" + +#define DEB(fmt, ...) pr_debug("ibtrs L%d " fmt, __LINE__, ##__VA_ARGS__) +#define DEB_RL(fmt, ...) pr_debug_ratelimited("ibtrs L%d " fmt, \ + __LINE__, ##__VA_ARGS__) +static inline void ibtrs_deb_msg_hdr(const char *prep, + const struct ibtrs_msg_hdr *hdr) +{ + DEB("%sibtrs msg hdr:\n" + "\ttype: %d\n" + "\ttsize: %d\n", prep, hdr->type, hdr->tsize); +} + +#define ERR_NP(fmt, ...) pr_err("ibtrs L%d ERR: " fmt, \ + __LINE__, ##__VA_ARGS__) + +#define WRN_NP(fmt, ...) pr_warn("ibtrs L%d WARN: " fmt, \ + __LINE__, ##__VA_ARGS__) +#define INFO_NP(fmt, ...) pr_info("ibtrs: " fmt, ##__VA_ARGS__) + +#define INFO_NP_RL(fmt, ...) pr_info_ratelimited("ibtrs: " fmt, ##__VA_ARGS__) + +#define ibtrs_prefix(sess) ((sess->hostname[0] != '\0') ? sess->hostname : \ + sess->addr) + +#define ERR(sess, fmt, ...) pr_err("ibtrs L%d <%s> ERR: " fmt, \ + __LINE__, ibtrs_prefix(sess), ##__VA_ARGS__) +#define ERR_RL(sess, fmt, ...) pr_err_ratelimited("ibtrs L%d <%s> ERR: " fmt, \ + __LINE__, ibtrs_prefix(sess), ##__VA_ARGS__) + +#define WRN(sess, fmt, ...) pr_warn("ibtrs L%d <%s> WARN: " fmt, \ + __LINE__, ibtrs_prefix(sess), ##__VA_ARGS__) +#define WRN_RL(sess, fmt, ...) pr_warn_ratelimited("ibtrs L%d <%s> WARN: " \ + fmt, __LINE__, ibtrs_prefix(sess), ##__VA_ARGS__) + +#define INFO(sess, fmt, ...) pr_info("ibtrs <%s>: " fmt, \ + ibtrs_prefix(sess), ##__VA_ARGS__) +#define INFO_RL(sess, fmt, ...) pr_info_ratelimited("ibtrs <%s>: " fmt, \ + ibtrs_prefix(sess), ##__VA_ARGS__) +#endif /*__IBTRS_LOG_H__*/