From patchwork Wed Apr 10 11:18:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Russkikh X-Patchwork-Id: 52570 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 E24A25F0D; Wed, 10 Apr 2019 13:18:56 +0200 (CEST) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-eopbgr790077.outbound.protection.outlook.com [40.107.79.77]) by dpdk.org (Postfix) with ESMTP id 2369F5B40 for ; Wed, 10 Apr 2019 13:18:55 +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=kvSJUxY3Hd87BTCv1/egR6GRmvrrw2nzzRakiVgcL3RS2BW820e6Ki7IqqaknIMrXU0qxyhCEUzgd72TM7Qxr3G6s81oHKuYXhQylc+ist/C+kpvNw+Wg32JMPXodt7JxWop91ksmlF0Bpcv8isLG9qZq2v5arAn7pDJ199abiI= Received: from BN8PR11MB3618.namprd11.prod.outlook.com (20.178.219.85) by BN8PR11MB3540.namprd11.prod.outlook.com (20.178.218.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.21; Wed, 10 Apr 2019 11:18:53 +0000 Received: from BN8PR11MB3618.namprd11.prod.outlook.com ([fe80::9d38:1845:842d:a489]) by BN8PR11MB3618.namprd11.prod.outlook.com ([fe80::9d38:1845:842d:a489%3]) with mapi id 15.20.1771.016; Wed, 10 Apr 2019 11:18:53 +0000 From: Igor Russkikh To: "dev@dpdk.org" CC: Pavel Belous , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , Konstantin Ananyev , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Igor Russkikh Thread-Topic: [PATCH 04/10] net/atlantic: macsec hardware structures declaration Thread-Index: AQHU748ub4X5ms1SVUKFEthV1/z/Ig== Date: Wed, 10 Apr 2019 11:18:53 +0000 Message-ID: <478e2875b86b3b097d152ac6a72fca6bc49e4aff.1554894242.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: BYAPR05CA0061.namprd05.prod.outlook.com (2603:10b6:a03:74::38) To BN8PR11MB3618.namprd11.prod.outlook.com (2603:10b6:408:85::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: 14c17447-1c14-45b8-dd61-08d6bda6507f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(2017052603328)(7193020); SRVR:BN8PR11MB3540; x-ms-traffictypediagnostic: BN8PR11MB3540: x-microsoft-antispam-prvs: x-forefront-prvs: 00032065B2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39850400004)(376002)(366004)(136003)(346002)(199004)(189003)(486006)(107886003)(6506007)(316002)(2616005)(386003)(54906003)(7416002)(53936002)(8936002)(68736007)(446003)(6916009)(476003)(72206003)(2501003)(105586002)(11346002)(44832011)(99286004)(2351001)(52116002)(186003)(26005)(118296001)(106356001)(14454004)(102836004)(76176011)(71200400001)(81156014)(7736002)(14444005)(8676002)(81166006)(25786009)(256004)(6116002)(5660300002)(71190400001)(1730700003)(5640700003)(2906002)(66066001)(6512007)(478600001)(6486002)(50226002)(305945005)(97736004)(4326008)(3846002)(36756003)(6436002)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN8PR11MB3540; H:BN8PR11MB3618.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: ylgMxDCZJ7ZHyc6xC9nMY3YdbRFAJHhfW2pKSSw2SxZc5E1yuy9ahQZ5mJduskBMjHmHyM7iAepd59km1bzQ3QXQBCYWuIGYnkwrAQy5ES9BEeiBJZmuZVJc8LtGjGx6E+NVlf86RYwGP+Yw91LGQZUcrknq/Pc2XFJvynPn5EE2X8y1otvcoJjhRn0Onu8wsRwoAJ36eFvKv5/tKb3n9rmxYd6iXZ+jpdOzNBPSnfXAXiAIGXZyZtsTaCG4kLc08JvuX+IgoJaPDxHEAKK7PWiTSl4kzajmFiQx/7LY8zY0SDzvGVvJLApYQE5laUO4EkHFtM7s9GDAL+RCvkJVwYHBpDam6hc0pgD6VPnCnVY5TLz2gKUkDi/eg4Qx1yCau0jA4sX7CDCJbuKeU7/2Dpcho8WVyGSM4zV4CbZv/TQ= MIME-Version: 1.0 X-OriginatorOrg: aquantia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14c17447-1c14-45b8-dd61-08d6bda6507f X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Apr 2019 11:18:53.5423 (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: BN8PR11MB3540 Subject: [dpdk-dev] [PATCH 04/10] 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