From patchwork Wed Nov 23 18:56:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 9444139 X-Patchwork-Delegate: ira.weiny@intel.com 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 010326075F for ; Wed, 23 Nov 2016 18:56:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B82527BFC for ; Wed, 23 Nov 2016 18:56:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F266227BE5; Wed, 23 Nov 2016 18:56:48 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 E011127BE5 for ; Wed, 23 Nov 2016 18:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933582AbcKWS4l (ORCPT ); Wed, 23 Nov 2016 13:56:41 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33752 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932959AbcKWS4k (ORCPT ); Wed, 23 Nov 2016 13:56:40 -0500 Received: by mail-wm0-f67.google.com with SMTP id u144so2857816wmu.0 for ; Wed, 23 Nov 2016 10:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=ueumisKPvXuPdzcsV8Tla6QWYC82flybCEKlVXeL0Fk=; b=qVcAXEbQUeID3emh9njwA639axvW5jG7yA6a+nfBo9AVZVyjRiwGELW4qQeH2+ufk6 he/Dzm7+rk5/PJwyb8eavqxdqL4hr2vCLbRpqKbMEhVs/SwikcT2z4F+cjxaddErA/94 x5cQfBVE2QylkkxX6wkEuZjpAKL3GS9lIcNU/+JKfPwxZuS4lv1AZzMYUoQqbfBjcl1K w5HG0skb4fdOG9X2ejBL8NIitWiTO88YNaKXw7geBCTBPOE+JzTw6ES3fDumRM79VIZp YcSqKG2n7pnhlnevRmgRcTx52BLQjSN5U4qYrJB9RVgw39Fdzecx9/jBeNCJplI7bPdC uRZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=ueumisKPvXuPdzcsV8Tla6QWYC82flybCEKlVXeL0Fk=; b=e7aRyeeFR9d9J2AcZOeJFhGXRCXPts72qDyvz5k/kj51n5hY35YZRhXm0YLC5pMHKR MlFOyxI2SCvc8Z7dn7Gi6QLr74MvxLhAUSU5S6tXbZymMBk3bA2olS18ScLYhc9YK2bR CG7vhtN6kB3tOI2zGwkBgBEABgaxnV9ZlpkSemYyJ0a6QxFc/0MRyPlfGjOz1Jo5UW2m P5A91lo7wTLB3ac1G94GcBKBm/X7C3/1qMZ3DJ8sVzby9bGGWbh1BnQF0tNwXDt/k2Au q2YdmfEoiUl0s64yu6s78TunwvwqSAmhNhmcTrHc3nXEjVOg4zuXdOHVbCk7ilns7PQV 1QlA== X-Gm-Message-State: AKaTC00h19wuzlhDeOagDXPH0//wS3BsWbbjueFSEMV7Fru2WOUMjfH4miFdNT3f3T6zgA== X-Received: by 10.28.27.208 with SMTP id b199mr4530486wmb.82.1479927398909; Wed, 23 Nov 2016 10:56:38 -0800 (PST) Received: from [192.168.1.183] (c-50-177-105-67.hsd1.ma.comcast.net. [50.177.105.67]) by smtp.googlemail.com with ESMTPSA id x188sm4205918wmx.4.2016.11.23.10.56.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Nov 2016 10:56:38 -0800 (PST) To: "Weiny, Ira" Cc: Eitan Zahavi , "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH infiniband-diags] ibsendtrap.c: Add support for security traps Message-ID: Date: Wed, 23 Nov 2016 13:56:36 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 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: Eitan Zahavi Add support for trap numbers 256, 257, and 258 Signed-off-by: Eitan Zahavi Signed-off-by: Hal Rosenstock --- -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index 659f2d2..7044deb 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -121,6 +121,64 @@ static void build_trap129(ib_mad_notice_attr_t * n, ib_portid_t * port) n->data_details.ntc_129_131.port_num = (uint8_t) error_port; } +static void build_trap256_local(ib_mad_notice_attr_t * n, ib_portid_t * port) +{ + n->generic_type = 0x80 | IB_NOTICE_TYPE_SECURITY; + n->g_or_v.generic.prod_type_lsb = cl_hton16(get_node_type(port)); + n->g_or_v.generic.trap_num = cl_hton16(256); + n->issuer_lid = cl_hton16((uint16_t) port->lid); + n->data_details.ntc_256.lid = n->issuer_lid; + n->data_details.ntc_256.dr_slid = 0xffff; + n->data_details.ntc_256.method = 1; + n->data_details.ntc_256.attr_id = cl_ntoh16(0x15); + n->data_details.ntc_256.attr_mod = cl_ntoh32(0x12); + n->data_details.ntc_256.mkey = cl_ntoh64(0x1234567812345678); +} + +static void build_trap256_lid(ib_mad_notice_attr_t * n, ib_portid_t * port) +{ + build_trap256_local(n, port); + n->data_details.ntc_256.dr_trunc_hop = 0; +} + +static void build_trap256_dr(ib_mad_notice_attr_t * n, ib_portid_t * port) +{ + build_trap256_local(n, port); + n->data_details.ntc_256.dr_trunc_hop = 0x80 | 0x4; + n->data_details.ntc_256.dr_rtn_path[0] = 5; + n->data_details.ntc_256.dr_rtn_path[1] = 6; + n->data_details.ntc_256.dr_rtn_path[2] = 7; + n->data_details.ntc_256.dr_rtn_path[3] = 8; +} + +static void build_trap257_258(ib_mad_notice_attr_t * n, ib_portid_t * port, + uint16_t trap_num) +{ + n->generic_type = 0x80 | IB_NOTICE_TYPE_SECURITY; + n->g_or_v.generic.prod_type_lsb = cl_hton16(get_node_type(port)); + n->g_or_v.generic.trap_num = cl_hton16(trap_num); + n->issuer_lid = cl_hton16((uint16_t) port->lid); + n->data_details.ntc_257_258.lid1 = cl_hton16(1); + n->data_details.ntc_257_258.lid2 = cl_hton16(2); + n->data_details.ntc_257_258.key = cl_hton32(0x12345678); + n->data_details.ntc_257_258.qp1 = cl_hton32(0x010101); + n->data_details.ntc_257_258.qp2 = cl_hton32(0x020202); + n->data_details.ntc_257_258.gid1.unicast.prefix = cl_ntoh64(0xf8c0000000000001); + n->data_details.ntc_257_258.gid1.unicast.interface_id = cl_ntoh64(0x1111222233334444); + n->data_details.ntc_257_258.gid2.unicast.prefix = cl_ntoh64(0xf8c0000000000001); + n->data_details.ntc_257_258.gid2.unicast.interface_id = cl_ntoh64(0x5678567812341234); +} + +static void build_trap257(ib_mad_notice_attr_t * n, ib_portid_t * port) +{ + build_trap257_258(n, port, 257); +} + +static void build_trap258(ib_mad_notice_attr_t * n, ib_portid_t * port) +{ + build_trap257_258(n, port, 258); +} + static int send_trap(void (*build) (ib_mad_notice_attr_t *, ib_portid_t *)) { ib_portid_t sm_port; @@ -159,6 +217,10 @@ static const trap_def_t traps[] = { {"link_speed_enabled_change", build_trap144_linkspeed}, {"local_link_integrity", build_trap129}, {"sys_image_guid_change", build_trap145}, + {"mkey_lid", build_trap256_lid}, + {"mkey_dr", build_trap256_dr}, + {"pkey", build_trap257}, + {"qkey", build_trap258}, {NULL, NULL} };