1501ef306SVadym Kochan /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ 2501ef306SVadym Kochan /* Copyright (c) 2020 Marvell International Ltd. All rights reserved. */ 3501ef306SVadym Kochan 4501ef306SVadym Kochan #ifndef __PRESTERA_DSA_H_ 5501ef306SVadym Kochan #define __PRESTERA_DSA_H_ 6501ef306SVadym Kochan 7501ef306SVadym Kochan #include <linux/types.h> 8501ef306SVadym Kochan 9501ef306SVadym Kochan #define PRESTERA_DSA_HLEN 16 10501ef306SVadym Kochan 11501ef306SVadym Kochan enum prestera_dsa_cmd { 12501ef306SVadym Kochan /* DSA command is "To CPU" */ 13501ef306SVadym Kochan PRESTERA_DSA_CMD_TO_CPU = 0, 14501ef306SVadym Kochan 15501ef306SVadym Kochan /* DSA command is "From CPU" */ 16501ef306SVadym Kochan PRESTERA_DSA_CMD_FROM_CPU, 17501ef306SVadym Kochan }; 18501ef306SVadym Kochan 19501ef306SVadym Kochan struct prestera_dsa_vlan { 20501ef306SVadym Kochan u16 vid; 21501ef306SVadym Kochan u8 vpt; 22501ef306SVadym Kochan u8 cfi_bit; 23501ef306SVadym Kochan bool is_tagged; 24501ef306SVadym Kochan }; 25501ef306SVadym Kochan 26501ef306SVadym Kochan struct prestera_dsa { 27501ef306SVadym Kochan struct prestera_dsa_vlan vlan; 28501ef306SVadym Kochan u32 hw_dev_num; 29501ef306SVadym Kochan u32 port_num; 30*0a9003f4SOleksandr Mazur u8 cpu_code; 31501ef306SVadym Kochan }; 32501ef306SVadym Kochan 33501ef306SVadym Kochan int prestera_dsa_parse(struct prestera_dsa *dsa, const u8 *dsa_buf); 34501ef306SVadym Kochan int prestera_dsa_build(const struct prestera_dsa *dsa, u8 *dsa_buf); 35501ef306SVadym Kochan 36501ef306SVadym Kochan #endif /* _PRESTERA_DSA_H_ */ 37