blob: 47e9768876e879e81ac2ca428b59b0342a2be133 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/* SPDX-License-Identifier: GPL-2.0-only */
/* Atlantic Network Driver
*
* Copyright (C) 2019 aQuantia Corporation
* Copyright (C) 2019-2020 Marvell International Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _ATL_MACSEC_H_
#define _ATL_MACSEC_H_
#include <linux/netdevice.h>
#if IS_ENABLED(CONFIG_MACSEC) && defined(NETIF_F_HW_MACSEC)
#include "net/macsec.h"
struct atl_hw;
struct atl_nic;
#define ATL_MACSEC_MAX_SC 32
#define ATL_MACSEC_MAX_SA 32
enum atl_macsec_sc_sa {
atl_macsec_sa_sc_4sa_8sc,
atl_macsec_sa_sc_not_used,
atl_macsec_sa_sc_2sa_16sc,
atl_macsec_sa_sc_1sa_32sc,
};
struct atl_macsec_common_stats {
/* Ingress Common Counters */
struct {
u64 ctl_pkts;
u64 tagged_miss_pkts;
u64 untagged_miss_pkts;
u64 notag_pkts;
u64 untagged_pkts;
u64 bad_tag_pkts;
u64 no_sci_pkts;
u64 unknown_sci_pkts;
u64 ctrl_prt_pass_pkts;
u64 unctrl_prt_pass_pkts;
u64 ctrl_prt_fail_pkts;
u64 unctrl_prt_fail_pkts;
u64 too_long_pkts;
u64 igpoc_ctl_pkts;
u64 ecc_error_pkts;
u64 unctrl_hit_drop_redir;
} in;
/* Egress Common Counters */
struct {
u64 ctl_pkts;
u64 unknown_sa_pkts;
u64 untagged_pkts;
u64 too_long;
u64 ecc_error_pkts;
u64 unctrl_hit_drop_redir;
} out;
};
/* Ingress SA Counters */
struct atl_macsec_rx_sa_stats {
u64 untagged_hit_pkts;
u64 ctrl_hit_drop_redir_pkts;
u64 not_using_sa;
u64 unused_sa;
u64 not_valid_pkts;
u64 invalid_pkts;
u64 ok_pkts;
u64 late_pkts;
u64 delayed_pkts;
u64 unchecked_pkts;
u64 validated_octets;
u64 decrypted_octets;
};
/* Egress SA Counters */
struct atl_macsec_tx_sa_stats {
u64 sa_hit_drop_redirect;
u64 sa_protected2_pkts;
u64 sa_protected_pkts;
u64 sa_encrypted_pkts;
};
/* Egress SC Counters */
struct atl_macsec_tx_sc_stats {
u64 sc_protected_pkts;
u64 sc_encrypted_pkts;
u64 sc_protected_octets;
u64 sc_encrypted_octets;
};
struct atl_macsec_txsc {
u32 hw_sc_idx;
unsigned long tx_sa_idx_busy;
const struct macsec_secy *sw_secy;
/* It is not OK to store key in driver but it is until ... */
u8 tx_sa_key[MACSEC_NUM_AN][MACSEC_KEYID_LEN];
struct atl_macsec_tx_sc_stats stats;
struct atl_macsec_tx_sa_stats tx_sa_stats[MACSEC_NUM_AN];
};
struct atl_macsec_rxsc {
u32 hw_sc_idx;
unsigned long rx_sa_idx_busy;
const struct macsec_secy *sw_secy;
const struct macsec_rx_sc *sw_rxsc;
/* TODO: we shouldn't store keys in the driver */
u8 rx_sa_key[MACSEC_NUM_AN][MACSEC_KEYID_LEN];
struct atl_macsec_rx_sa_stats rx_sa_stats[MACSEC_NUM_AN];
};
struct atl_macsec_cfg {
enum atl_macsec_sc_sa sc_sa;
/* Egress channel configuration */
unsigned long txsc_idx_busy;
struct atl_macsec_txsc atl_txsc[ATL_MACSEC_MAX_SC];
/* Ingress channel configuration */
unsigned long rxsc_idx_busy;
struct atl_macsec_rxsc atl_rxsc[ATL_MACSEC_MAX_SC];
struct atl_macsec_common_stats stats;
};
extern const struct macsec_ops atl_macsec_ops;
int atl_init_macsec(struct atl_hw *hw);
void atl_macsec_work(struct atl_nic *nic);
int atl_macsec_rx_sa_cnt(struct atl_hw *hw);
int atl_macsec_tx_sc_cnt(struct atl_hw *hw);
int atl_macsec_tx_sa_cnt(struct atl_hw *hw);
int atl_macsec_update_stats(struct atl_hw *hw);
#endif
#endif /* _ATL_MACSEC_H_ */
|