From patchwork Wed Apr 17 15:45:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Russkikh X-Patchwork-Id: 52879 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A1EAD1B72C; Wed, 17 Apr 2019 17:45:31 +0200 (CEST) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-eopbgr740089.outbound.protection.outlook.com [40.107.74.89]) by dpdk.org (Postfix) with ESMTP id A25C11B724 for ; Wed, 17 Apr 2019 17:45:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=AQUANTIA1COM.onmicrosoft.com; s=selector1-aquantia-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vFby3ITODIio0JwNMsmgYlR7gKfO1p3o6nBzNwyOUUQ=; b=dCquNBHhNYAuAgsYI9Yxp/xufK9KknMgkXOyxmHkveUs62ujdjb+IBu2wcKm6h7c4DBqZOX3tpAaOlkW/agEyrl9zuHmWoApe9SdRMMAavPBWEW7KZQfDTe/8JVCYypv7UYDx9R+b+0ll/vLGwNqApTxA9SBZv2jeic+gAZWvik= Received: from DM6PR11MB3625.namprd11.prod.outlook.com (20.178.230.149) by DM6PR11MB3738.namprd11.prod.outlook.com (20.179.16.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1813.12; Wed, 17 Apr 2019 15:45:28 +0000 Received: from DM6PR11MB3625.namprd11.prod.outlook.com ([fe80::f035:2c20:5a61:7653]) by DM6PR11MB3625.namprd11.prod.outlook.com ([fe80::f035:2c20:5a61:7653%3]) with mapi id 15.20.1813.011; Wed, 17 Apr 2019 15:45:28 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: "ferruh.yigit@intel.com" , "thomas@monjalon.net" , "arybchenko@solarflare.com" , "konstantin.ananyev@intel.com" , Igor Russkikh , Pavel Belous Thread-Topic: [PATCH v2 1/7] net/atlantic: macsec hardware structures declaration Thread-Index: AQHU9TSUBZLFVESFd02tjp25fI0LPg== Date: Wed, 17 Apr 2019 15:45:28 +0000 Message-ID: <85a9511657c50db1d9767bcd73022f7092cad0a5.1555515863.git.igor.russkikh@aquantia.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR07CA0027.namprd07.prod.outlook.com (2603:10b6:a02:bc::40) To DM6PR11MB3625.namprd11.prod.outlook.com (2603:10b6:5:13a::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Igor.Russkikh@aquantia.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [95.79.108.179] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 946635dc-5e1b-4c93-661f-08d6c34bb6c8 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600140)(711020)(4605104)(2017052603328)(7193020); SRVR:DM6PR11MB3738; x-ms-traffictypediagnostic: DM6PR11MB3738: x-microsoft-antispam-prvs: x-forefront-prvs: 0010D93EFE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39850400004)(346002)(396003)(136003)(376002)(366004)(199004)(189003)(2906002)(25786009)(54906003)(14444005)(256004)(7736002)(97736004)(316002)(4326008)(71200400001)(53936002)(5640700003)(107886003)(71190400001)(99286004)(68736007)(8676002)(1730700003)(5660300002)(86362001)(2351001)(6512007)(305945005)(52116002)(6436002)(106356001)(81166006)(2501003)(36756003)(81156014)(105586002)(8936002)(6916009)(386003)(102836004)(26005)(6116002)(186003)(50226002)(72206003)(6506007)(76176011)(6486002)(14454004)(66066001)(478600001)(3846002)(476003)(118296001)(486006)(2616005)(44832011)(446003)(11346002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR11MB3738; H:DM6PR11MB3625.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: aquantia.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: uIqekEkweBPFNRcoWqkzVfRlq/6166yiIsQsUJiozPlGGRidDur3MNOve1k+wYMQ72rEE+PSyXQgh0cYWJj3zhs9/wv1F/u8zZIKl6tU4FDGg+IJDqnh44uocKUpWET/rwpblCWLxAkoXY2uJNgtEcvk5gqN2L1NC9cEKNELz1GF6Y0WRbZsqLTOx1gN18Q7h16f4uDkGCl2H3y235jk32t+a9neBT/D8LHWHFhp0vKTSQLA/BBgy/WimAQZ6OjVli29gwtWr4M7jHvbTzuQyCisk4xrbseWt9HRVjWh7xJucYsaqdIqxj31iwLoCjt70SRXlzGB1qXwVN/64W24Q7WdMstUrQxeoMhFkjFsJtjC0RK4O9sHpUIsbfZiCMF/pzXMLAgXUDVuovFzizWOD7UXLyTtaYn/T8kmqGF1EWo= MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 946635dc-5e1b-4c93-661f-08d6c34bb6c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Apr 2019 15:45:28.0246 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83e2e134-991c-4ede-8ced-34d47e38e6b1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3738 Subject: [dpdk-dev] [PATCH v2 1/7] net/atlantic: macsec hardware structures declaration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Pavel Belous Here we define hardware and software configuration structures for macsec interface. MACSEC itself is implemented in Phy module, but its configuration is done via firmware interface Signed-off-by: Pavel Belous Signed-off-by: Igor Russkikh --- drivers/net/atlantic/atl_types.h | 37 ++++++ drivers/net/atlantic/hw_atl/hw_atl_utils.h | 148 +++++++++++++++++++++ 2 files changed, 185 insertions(+) diff --git a/drivers/net/atlantic/atl_types.h b/drivers/net/atlantic/atl_types.h index 3edaf0c7c047..3cc9e96089e8 100644 --- a/drivers/net/atlantic/atl_types.h +++ b/drivers/net/atlantic/atl_types.h @@ -59,6 +59,39 @@ struct aq_rss_parameters { u8 indirection_table[HW_ATL_B0_RSS_REDIRECTION_MAX]; }; +/* Macsec stuff */ +struct aq_macsec_config { + struct { + u32 macsec_enabled; + u32 encryption_enabled; + u32 replay_protection_enabled; + } common; + + struct { + u32 idx; + u32 mac[2]; /* 6 bytes */ + } txsc; + + struct { + u32 idx; + u32 an; /* association number on the local side */ + u32 pn; /* packet number on the local side */ + u32 key[4]; /* 128 bit key */ + } txsa; + + struct { + u32 mac[2]; /* 6 bytes */ + u32 pi; + } rxsc; + + struct { + u32 idx; + u32 an; /* association number on the remote side */ + u32 pn; /* packet number on the remote side */ + u32 key[4]; /* 128 bit key */ + } rxsa; +}; + struct aq_hw_cfg_s { bool is_lro; bool is_rss; @@ -75,6 +108,7 @@ struct aq_hw_cfg_s { uint32_t flow_control; struct aq_rss_parameters aq_rss; + struct aq_macsec_config aq_macsec; }; struct aq_hw_s { @@ -143,6 +177,9 @@ struct aq_fw_ops { int (*set_eeprom)(struct aq_hw_s *self, int dev_addr, u32 *data, u32 len); + int (*send_macsec_req)(struct aq_hw_s *self, + struct macsec_msg_fw_request *req, + struct macsec_msg_fw_response *response); }; struct atl_sw_stats { diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.h b/drivers/net/atlantic/hw_atl/hw_atl_utils.h index f2a87826c0d1..b7c531573623 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils.h +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.h @@ -351,6 +351,154 @@ struct smbus_write_request { u32 length; } __attribute__((__packed__)); +enum macsec_msg_type { + macsec_cfg_msg = 0, + macsec_add_rx_sc_msg, + macsec_add_tx_sc_msg, + macsec_add_rx_sa_msg, + macsec_add_tx_sa_msg, + macsec_get_stats_msg, +}; + +struct macsec_cfg { + uint32_t enabled; + uint32_t egress_threshold; + uint32_t ingress_threshold; + uint32_t interrupts_enabled; +} __attribute__((__packed__)); + +struct add_rx_sc { + uint32_t index; + uint32_t pi; /* Port identifier */ + uint32_t sci[2]; /* Secure Channel identifier */ + uint32_t sci_mask; /* 1: enable comparison of SCI, 0: don't care */ + uint32_t tci; + uint32_t tci_mask; + uint32_t mac_sa[2]; + uint32_t sa_mask; /* 0: ignore mac_sa */ + uint32_t mac_da[2]; + uint32_t da_mask; /* 0: ignore mac_da */ + uint32_t validate_frames; /* 0: strict, 1:check, 2:disabled */ + uint32_t replay_protect; /* 1: enabled, 0:disabled */ + uint32_t anti_replay_window; /* default 0 */ + /* 1: auto_rollover enabled (when SA next_pn is saturated */ + uint32_t an_rol; +} __attribute__((__packed__)); + +struct add_tx_sc { + uint32_t index; + uint32_t pi; /* Port identifier */ + uint32_t sci[2]; /* Secure Channel identifier */ + uint32_t sci_mask; /* 1: enable comparison of SCI, 0: don't care */ + uint32_t tci; /* TCI value, used if packet is not explicitly tagged */ + uint32_t tci_mask; + uint32_t mac_sa[2]; + uint32_t sa_mask; /* 0: ignore mac_sa */ + uint32_t mac_da[2]; + uint32_t da_mask; /* 0: ignore mac_da */ + uint32_t protect; + uint32_t curr_an; /* SA index which currently used */ +} __attribute__((__packed__)); + +struct add_rx_sa { + uint32_t index; + uint32_t next_pn; + uint32_t key[4]; /* 128 bit key */ +} __attribute__((__packed__)); + +struct add_tx_sa { + uint32_t index; + uint32_t next_pn; + uint32_t key[4]; /* 128 bit key */ +} __attribute__((__packed__)); + +struct get_stats { + uint32_t version_only; + uint32_t ingress_sa_index; + uint32_t egress_sa_index; + uint32_t egress_sc_index; +} __attribute__((__packed__)); + +struct macsec_stats { + uint32_t api_version; + /* Ingress Common Counters */ + uint64_t in_ctl_pkts; + uint64_t in_tagged_miss_pkts; + uint64_t in_untagged_miss_pkts; + uint64_t in_notag_pkts; + uint64_t in_untagged_pkts; + uint64_t in_bad_tag_pkts; + uint64_t in_no_sci_pkts; + uint64_t in_unknown_sci_pkts; + uint64_t in_ctrl_prt_pass_pkts; + uint64_t in_unctrl_prt_pass_pkts; + uint64_t in_ctrl_prt_fail_pkts; + uint64_t in_unctrl_prt_fail_pkts; + uint64_t in_too_long_pkts; + uint64_t in_igpoc_ctl_pkts; + uint64_t in_ecc_error_pkts; + uint64_t in_unctrl_hit_drop_redir; + + /* Egress Common Counters */ + uint64_t out_ctl_pkts; + uint64_t out_unknown_sa_pkts; + uint64_t out_untagged_pkts; + uint64_t out_too_long; + uint64_t out_ecc_error_pkts; + uint64_t out_unctrl_hit_drop_redir; + + /* Ingress SA Counters */ + uint64_t in_untagged_hit_pkts; + uint64_t in_ctrl_hit_drop_redir_pkts; + uint64_t in_not_using_sa; + uint64_t in_unused_sa; + uint64_t in_not_valid_pkts; + uint64_t in_invalid_pkts; + uint64_t in_ok_pkts; + uint64_t in_late_pkts; + uint64_t in_delayed_pkts; + uint64_t in_unchecked_pkts; + uint64_t in_validated_octets; + uint64_t in_decrypted_octets; + + /* Egress SA Counters */ + uint64_t out_sa_hit_drop_redirect; + uint64_t out_sa_protected2_pkts; + uint64_t out_sa_protected_pkts; + uint64_t out_sa_encrypted_pkts; + + /* Egress SC Counters */ + uint64_t out_sc_protected_pkts; + uint64_t out_sc_encrypted_pkts; + uint64_t out_sc_protected_octets; + uint64_t out_sc_encrypted_octets; + + /* SA Counters expiration info */ + uint32_t egress_threshold_expired; + uint32_t ingress_threshold_expired; + uint32_t egress_expired; + uint32_t ingress_expired; +} __attribute__((__packed__)); + +struct macsec_msg_fw_request { + uint32_t offset; /* not used */ + uint32_t msg_type; + + union { + struct macsec_cfg cfg; + struct add_rx_sc rxsc; + struct add_tx_sc txsc; + struct add_rx_sa rxsa; + struct add_tx_sa txsa; + struct get_stats stats; + }; +} __attribute__((__packed__)); + +struct macsec_msg_fw_response { + uint32_t result; + struct macsec_stats stats; +} __attribute__((__packed__)); + #define HAL_ATLANTIC_UTILS_CHIP_MIPS 0x00000001U #define HAL_ATLANTIC_UTILS_CHIP_TPO2 0x00000002U #define HAL_ATLANTIC_UTILS_CHIP_RPF2 0x00000004U