Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 4d8e74ad4585672489da6145b3328d415f50db82 128 lines 2.6 kB view raw
1/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2/* Copyright 2025 NXP */ 3#ifndef __NETC_NTMP_H 4#define __NETC_NTMP_H 5 6#include <linux/bitops.h> 7#include <linux/if_ether.h> 8 9struct maft_keye_data { 10 u8 mac_addr[ETH_ALEN]; 11 __le16 resv; 12}; 13 14struct maft_cfge_data { 15 __le16 si_bitmap; 16 __le16 resv; 17}; 18 19struct netc_cbdr_regs { 20 void __iomem *pir; 21 void __iomem *cir; 22 void __iomem *mr; 23 24 void __iomem *bar0; 25 void __iomem *bar1; 26 void __iomem *lenr; 27}; 28 29struct netc_tbl_vers { 30 u8 maft_ver; 31 u8 rsst_ver; 32}; 33 34struct netc_swcbd { 35 void *buf; 36 dma_addr_t dma; 37 size_t size; 38}; 39 40struct netc_cbdr { 41 struct device *dev; 42 struct netc_cbdr_regs regs; 43 44 int bd_num; 45 int next_to_use; 46 int next_to_clean; 47 48 int dma_size; 49 void *addr_base; 50 void *addr_base_align; 51 dma_addr_t dma_base; 52 dma_addr_t dma_base_align; 53 struct netc_swcbd *swcbd; 54 55 /* Serialize the order of command BD ring */ 56 struct mutex ring_lock; 57}; 58 59struct ntmp_user { 60 int cbdr_num; /* number of control BD ring */ 61 struct device *dev; 62 struct netc_cbdr *ring; 63 struct netc_tbl_vers tbl; 64}; 65 66struct maft_entry_data { 67 struct maft_keye_data keye; 68 struct maft_cfge_data cfge; 69}; 70 71#if IS_ENABLED(CONFIG_NXP_NETC_LIB) 72int ntmp_init_cbdr(struct netc_cbdr *cbdr, struct device *dev, 73 const struct netc_cbdr_regs *regs); 74void ntmp_free_cbdr(struct netc_cbdr *cbdr); 75 76/* NTMP APIs */ 77int ntmp_maft_add_entry(struct ntmp_user *user, u32 entry_id, 78 struct maft_entry_data *maft); 79int ntmp_maft_query_entry(struct ntmp_user *user, u32 entry_id, 80 struct maft_entry_data *maft); 81int ntmp_maft_delete_entry(struct ntmp_user *user, u32 entry_id); 82int ntmp_rsst_update_entry(struct ntmp_user *user, const u32 *table, 83 int count); 84int ntmp_rsst_query_entry(struct ntmp_user *user, 85 u32 *table, int count); 86#else 87static inline int ntmp_init_cbdr(struct netc_cbdr *cbdr, struct device *dev, 88 const struct netc_cbdr_regs *regs) 89{ 90 return 0; 91} 92 93static inline void ntmp_free_cbdr(struct netc_cbdr *cbdr) 94{ 95} 96 97static inline int ntmp_maft_add_entry(struct ntmp_user *user, u32 entry_id, 98 struct maft_entry_data *maft) 99{ 100 return 0; 101} 102 103static inline int ntmp_maft_query_entry(struct ntmp_user *user, u32 entry_id, 104 struct maft_entry_data *maft) 105{ 106 return 0; 107} 108 109static inline int ntmp_maft_delete_entry(struct ntmp_user *user, u32 entry_id) 110{ 111 return 0; 112} 113 114static inline int ntmp_rsst_update_entry(struct ntmp_user *user, 115 const u32 *table, int count) 116{ 117 return 0; 118} 119 120static inline int ntmp_rsst_query_entry(struct ntmp_user *user, 121 u32 *table, int count) 122{ 123 return 0; 124} 125 126#endif 127 128#endif