Skip to content

Commit cfc1418

Browse files
Geetha sowjanyadavem330
authored andcommitted
octeontx2-af: cn10k: mcs: Manage the MCS block hardware resources
To establish a macsec connection association netdev driver needs hardware resources like SecY, TCAM flows, SCs and SAs. This patch manages allocating, freeing and configuring those resources. AF consumers can request resources and configure them via these mailbox messages. AF can allocate until it runs out of hardware resources. Signed-off-by: Geetha sowjanya <[email protected]> Signed-off-by: Vamsi Attunuru <[email protected]> Signed-off-by: Sunil Goutham <[email protected]> Signed-off-by: Subbaraya Sundeep <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 080bbd1 commit cfc1418

File tree

6 files changed

+1530
-1
lines changed

6 files changed

+1530
-1
lines changed

drivers/net/ethernet/marvell/octeontx2/af/mbox.h

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,38 @@ M(NIX_BANDPROF_FREE, 0x801e, nix_bandprof_free, nix_bandprof_free_req, \
295295
M(NIX_BANDPROF_GET_HWINFO, 0x801f, nix_bandprof_get_hwinfo, msg_req, \
296296
nix_bandprof_get_hwinfo_rsp) \
297297
/* MCS mbox IDs (range 0xA000 - 0xBFFF) */ \
298+
M(MCS_ALLOC_RESOURCES, 0xa000, mcs_alloc_resources, mcs_alloc_rsrc_req, \
299+
mcs_alloc_rsrc_rsp) \
300+
M(MCS_FREE_RESOURCES, 0xa001, mcs_free_resources, mcs_free_rsrc_req, msg_rsp) \
301+
M(MCS_FLOWID_ENTRY_WRITE, 0xa002, mcs_flowid_entry_write, mcs_flowid_entry_write_req, \
302+
msg_rsp) \
303+
M(MCS_SECY_PLCY_WRITE, 0xa003, mcs_secy_plcy_write, mcs_secy_plcy_write_req, \
304+
msg_rsp) \
305+
M(MCS_RX_SC_CAM_WRITE, 0xa004, mcs_rx_sc_cam_write, mcs_rx_sc_cam_write_req, \
306+
msg_rsp) \
307+
M(MCS_SA_PLCY_WRITE, 0xa005, mcs_sa_plcy_write, mcs_sa_plcy_write_req, \
308+
msg_rsp) \
309+
M(MCS_TX_SC_SA_MAP_WRITE, 0xa006, mcs_tx_sc_sa_map_write, mcs_tx_sc_sa_map, \
310+
msg_rsp) \
311+
M(MCS_RX_SC_SA_MAP_WRITE, 0xa007, mcs_rx_sc_sa_map_write, mcs_rx_sc_sa_map, \
312+
msg_rsp) \
313+
M(MCS_FLOWID_ENA_ENTRY, 0xa008, mcs_flowid_ena_entry, mcs_flowid_ena_dis_entry, \
314+
msg_rsp) \
315+
M(MCS_PN_TABLE_WRITE, 0xa009, mcs_pn_table_write, mcs_pn_table_write_req, \
316+
msg_rsp) \
298317
M(MCS_SET_ACTIVE_LMAC, 0xa00a, mcs_set_active_lmac, mcs_set_active_lmac, \
299318
msg_rsp) \
300319
M(MCS_GET_HW_INFO, 0xa00b, mcs_get_hw_info, msg_req, mcs_hw_info) \
301320
M(MCS_SET_LMAC_MODE, 0xa013, mcs_set_lmac_mode, mcs_set_lmac_mode, msg_rsp) \
321+
M(MCS_SET_PN_THRESHOLD, 0xa014, mcs_set_pn_threshold, mcs_set_pn_threshold, \
322+
msg_rsp) \
323+
M(MCS_ALLOC_CTRL_PKT_RULE, 0xa015, mcs_alloc_ctrl_pkt_rule, \
324+
mcs_alloc_ctrl_pkt_rule_req, \
325+
mcs_alloc_ctrl_pkt_rule_rsp) \
326+
M(MCS_FREE_CTRL_PKT_RULE, 0xa016, mcs_free_ctrl_pkt_rule, \
327+
mcs_free_ctrl_pkt_rule_req, msg_rsp) \
328+
M(MCS_CTRL_PKT_RULE_WRITE, 0xa017, mcs_ctrl_pkt_rule_write, \
329+
mcs_ctrl_pkt_rule_write_req, msg_rsp) \
302330
M(MCS_PORT_RESET, 0xa018, mcs_port_reset, mcs_port_reset_req, msg_rsp) \
303331
M(MCS_PORT_CFG_SET, 0xa019, mcs_port_cfg_set, mcs_port_cfg_set_req, msg_rsp)\
304332
M(MCS_PORT_CFG_GET, 0xa020, mcs_port_cfg_get, mcs_port_cfg_get_req, \
@@ -1674,6 +1702,133 @@ enum mcs_direction {
16741702
MCS_TX,
16751703
};
16761704

1705+
enum mcs_rsrc_type {
1706+
MCS_RSRC_TYPE_FLOWID,
1707+
MCS_RSRC_TYPE_SECY,
1708+
MCS_RSRC_TYPE_SC,
1709+
MCS_RSRC_TYPE_SA,
1710+
};
1711+
1712+
struct mcs_alloc_rsrc_req {
1713+
struct mbox_msghdr hdr;
1714+
u8 rsrc_type;
1715+
u8 rsrc_cnt; /* Resources count */
1716+
u8 mcs_id; /* MCS block ID */
1717+
u8 dir; /* Macsec ingress or egress side */
1718+
u8 all; /* Allocate all resource type one each */
1719+
u64 rsvd;
1720+
};
1721+
1722+
struct mcs_alloc_rsrc_rsp {
1723+
struct mbox_msghdr hdr;
1724+
u8 flow_ids[128]; /* Index of reserved entries */
1725+
u8 secy_ids[128];
1726+
u8 sc_ids[128];
1727+
u8 sa_ids[256];
1728+
u8 rsrc_type;
1729+
u8 rsrc_cnt; /* No of entries reserved */
1730+
u8 mcs_id;
1731+
u8 dir;
1732+
u8 all;
1733+
u8 rsvd[256]; /* reserved fields for future expansion */
1734+
};
1735+
1736+
struct mcs_free_rsrc_req {
1737+
struct mbox_msghdr hdr;
1738+
u8 rsrc_id; /* Index of the entry to be freed */
1739+
u8 rsrc_type;
1740+
u8 mcs_id;
1741+
u8 dir;
1742+
u8 all; /* Free all the cam resources */
1743+
u64 rsvd;
1744+
};
1745+
1746+
struct mcs_flowid_entry_write_req {
1747+
struct mbox_msghdr hdr;
1748+
u64 data[4];
1749+
u64 mask[4];
1750+
u64 sci; /* CNF10K-B for tx_secy_mem_map */
1751+
u8 flow_id;
1752+
u8 secy_id; /* secyid for which flowid is mapped */
1753+
u8 sc_id; /* Valid if dir = MCS_TX, SC_CAM id mapped to flowid */
1754+
u8 ena; /* Enable tcam entry */
1755+
u8 ctrl_pkt;
1756+
u8 mcs_id;
1757+
u8 dir;
1758+
u64 rsvd;
1759+
};
1760+
1761+
struct mcs_secy_plcy_write_req {
1762+
struct mbox_msghdr hdr;
1763+
u64 plcy;
1764+
u8 secy_id;
1765+
u8 mcs_id;
1766+
u8 dir;
1767+
u64 rsvd;
1768+
};
1769+
1770+
/* RX SC_CAM mapping */
1771+
struct mcs_rx_sc_cam_write_req {
1772+
struct mbox_msghdr hdr;
1773+
u64 sci; /* SCI */
1774+
u64 secy_id; /* secy index mapped to SC */
1775+
u8 sc_id; /* SC CAM entry index */
1776+
u8 mcs_id;
1777+
u64 rsvd;
1778+
};
1779+
1780+
struct mcs_sa_plcy_write_req {
1781+
struct mbox_msghdr hdr;
1782+
u64 plcy[2][9]; /* Support 2 SA policy */
1783+
u8 sa_index[2];
1784+
u8 sa_cnt;
1785+
u8 mcs_id;
1786+
u8 dir;
1787+
u64 rsvd;
1788+
};
1789+
1790+
struct mcs_tx_sc_sa_map {
1791+
struct mbox_msghdr hdr;
1792+
u8 sa_index0;
1793+
u8 sa_index1;
1794+
u8 rekey_ena;
1795+
u8 sa_index0_vld;
1796+
u8 sa_index1_vld;
1797+
u8 tx_sa_active;
1798+
u64 sectag_sci;
1799+
u8 sc_id; /* used as index for SA_MEM_MAP */
1800+
u8 mcs_id;
1801+
u64 rsvd;
1802+
};
1803+
1804+
struct mcs_rx_sc_sa_map {
1805+
struct mbox_msghdr hdr;
1806+
u8 sa_index;
1807+
u8 sa_in_use;
1808+
u8 sc_id;
1809+
u8 an; /* value range 0-3, sc_id + an used as index SA_MEM_MAP */
1810+
u8 mcs_id;
1811+
u64 rsvd;
1812+
};
1813+
1814+
struct mcs_flowid_ena_dis_entry {
1815+
struct mbox_msghdr hdr;
1816+
u8 flow_id;
1817+
u8 ena;
1818+
u8 mcs_id;
1819+
u8 dir;
1820+
u64 rsvd;
1821+
};
1822+
1823+
struct mcs_pn_table_write_req {
1824+
struct mbox_msghdr hdr;
1825+
u64 next_pn;
1826+
u8 pn_id;
1827+
u8 mcs_id;
1828+
u8 dir;
1829+
u64 rsvd;
1830+
};
1831+
16771832
struct mcs_hw_info {
16781833
struct mbox_msghdr hdr;
16791834
u8 num_mcs_blks; /* Number of MCS blocks */
@@ -1762,4 +1917,60 @@ enum mcs_af_status {
17621917
MCS_AF_ERR_NOT_MAPPED = -1202,
17631918
};
17641919

1920+
struct mcs_set_pn_threshold {
1921+
struct mbox_msghdr hdr;
1922+
u64 threshold;
1923+
u8 xpn; /* '1' for setting xpn threshold */
1924+
u8 mcs_id;
1925+
u8 dir;
1926+
u64 rsvd;
1927+
};
1928+
1929+
enum mcs_ctrl_pkt_rulew_type {
1930+
MCS_CTRL_PKT_RULE_TYPE_ETH,
1931+
MCS_CTRL_PKT_RULE_TYPE_DA,
1932+
MCS_CTRL_PKT_RULE_TYPE_RANGE,
1933+
MCS_CTRL_PKT_RULE_TYPE_COMBO,
1934+
MCS_CTRL_PKT_RULE_TYPE_MAC,
1935+
};
1936+
1937+
struct mcs_alloc_ctrl_pkt_rule_req {
1938+
struct mbox_msghdr hdr;
1939+
u8 rule_type;
1940+
u8 mcs_id; /* MCS block ID */
1941+
u8 dir; /* Macsec ingress or egress side */
1942+
u64 rsvd;
1943+
};
1944+
1945+
struct mcs_alloc_ctrl_pkt_rule_rsp {
1946+
struct mbox_msghdr hdr;
1947+
u8 rule_idx;
1948+
u8 rule_type;
1949+
u8 mcs_id;
1950+
u8 dir;
1951+
u64 rsvd;
1952+
};
1953+
1954+
struct mcs_free_ctrl_pkt_rule_req {
1955+
struct mbox_msghdr hdr;
1956+
u8 rule_idx;
1957+
u8 rule_type;
1958+
u8 mcs_id;
1959+
u8 dir;
1960+
u8 all;
1961+
u64 rsvd;
1962+
};
1963+
1964+
struct mcs_ctrl_pkt_rule_write_req {
1965+
struct mbox_msghdr hdr;
1966+
u64 data0;
1967+
u64 data1;
1968+
u64 data2;
1969+
u8 rule_idx;
1970+
u8 rule_type;
1971+
u8 mcs_id;
1972+
u8 dir;
1973+
u64 rsvd;
1974+
};
1975+
17651976
#endif /* MBOX_H */

0 commit comments

Comments
 (0)