1 /* 2 * Copyright (c) 2021 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: i_qal_bridge 21 * QCA abstraction layer (QAL) bridge APIs 22 */ 23 24 #if !defined(__I_QAL_BRIDGE_H) 25 #define __I_QAL_BRIDGE_H 26 27 /* Include Files */ 28 #include <linux/if_bridge.h> 29 #include "qdf_types.h" 30 31 typedef struct notifier_block *__qal_notify_blk_t; 32 typedef struct net_device *__qal_netdev_t; 33 typedef struct net_bridge_fdb_entry *__qal_br_fdb_entry_t; 34 35 static inline QDF_STATUS 36 __qal_bridge_fdb_register_notify(__qal_notify_blk_t nb) 37 { 38 br_fdb_register_notify(nb); 39 return QDF_STATUS_SUCCESS; 40 } 41 42 static inline QDF_STATUS 43 __qal_bridge_fdb_unregister_notify(__qal_notify_blk_t nb) 44 { 45 br_fdb_unregister_notify(nb); 46 return QDF_STATUS_SUCCESS; 47 } 48 49 static inline __qal_br_fdb_entry_t 50 __qal_bridge_fdb_has_entry(__qal_netdev_t dev, const char *addr, uint16_t vid) 51 { 52 return br_fdb_has_entry(dev, addr, vid); 53 } 54 55 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 24) 56 static inline QDF_STATUS 57 __qal_bridge_fdb_delete_by_netdev(__qal_netdev_t dev, 58 const unsigned char *addr, uint16_t vid) 59 { 60 /* Use 5.4-specific API */ 61 return QDF_STATUS_SUCCESS; 62 } 63 #else 64 static inline QDF_STATUS 65 __qal_bridge_fdb_delete_by_netdev(__qal_netdev_t dev, 66 const unsigned char *addr, uint16_t vid) 67 { 68 int ret; 69 70 ret = br_fdb_delete_by_netdev(dev, addr, vid); 71 72 return qdf_status_from_os_return(ret); 73 } 74 #endif 75 76 static inline QDF_STATUS 77 __qal_bridge_fdb_update_register_notify(__qal_notify_blk_t nb) 78 { 79 br_fdb_update_register_notify(nb); 80 return QDF_STATUS_SUCCESS; 81 } 82 83 static inline QDF_STATUS 84 __qal_bridge_fdb_update_unregister_notify(__qal_notify_blk_t nb) 85 { 86 br_fdb_update_unregister_notify(nb); 87 return QDF_STATUS_SUCCESS; 88 } 89 90 #endif /* __I_QAL_BRIDGE_H */ 91