index 7bc17e4b02cd971ac148696132fa71ecda136f9e..672d2b486b66010c4ead5000f8b9499a6284f0ad 100755 (executable)
-/***************************************************
- * File: netcp_cfg.h
- * Purpose: netcp config API
- **************************************************************
- *@file netcp_cfg.h
- *
- * @brief DESCRIPTION: netapi NETCP configuration API header file
- * for user space transport library
- *
- * REVISION HISTORY: rev 0.0.1
+/******************************************************************************
+ * FILE PURPOSE: netapi NETCP configuration API header file
+ ******************************************************************************
+ * FILE NAME: netcp_cfg.h
+ *
+ * DESCRIPTION:netapi NETCP configuration API header file for user space transport library
+ *
+ * REVISION HISTORY:
*
* Copyright (c) Texas Instruments Incorporated 2010-2011
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
* are met:
*
- * Redistributions of source code must retain the above copyright
+ * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/* ============================================================= */
+
+/**
+ * @file netcp_cfg.h
+ * @brief Netapi NETCP configuration API header file for user space transport library
+ */
+
- ***************************************************/
#ifndef __NETCP_CFG__H
#define __NETCP_CFG__H
#include "ti/drv/pa/pa.h"
#include "ti/runtime/pktlib/pktlib.h"
-//NETCP FLOW
+
+/**
+ * @ingroup cfg_structures
+ * @brief CPPI flow ID for default case, use NETCP_DEFAULT_FLOW
+ */
typedef struct NETCP_CFG_FLOW_Tag
{
- int flowid;
+ int flowid; /**< flow id*/
} NETCP_CFG_FLOW_T;
+
+
+/**
+ * @ingroup cfg_structures
+ * @brief NETAPI configuration information
+ *
+ * @details The parameters in this structure are used to configure NETAPI.
+ */
+typedef struct NETAPI_CFG_Tag
+{
+ int def_mem_size; /**< Bytes of CMA memory we have allocated */
+ int def_flow_pkt_rx_offset; /**< Offset in pkt buffer for hw to start RX */
+ int def_max_descriptors; /**< Number of descriptors in system (must be power of 2), 2^14 max */
+ int def_tot_descriptors_for_us; /**< Number of descriptors to create in our region (must be power of 2)*/
+ int def_heap_n_descriptors; /**< Number of descriptor plus buffers in default heap*/
+ int def_heap_n_zdescriptors; /**< Number of zero len descriptors in defaut heap*/
+ int def_heap_buf_size; /**< Size of buffers in default heap, max amount of area for packet data */
+ int def_heap_tailroom_size; /**< Size of tailroom in reserve */
+ int def_heap_extra_size; /**< Size of extra space at end of buffer */
+} NETAPI_CFG_T;
+
+/* @note:
+ each buffer will be allocated: def_heap_buf_size+def_heap_extra_size bytes
+ each descriptor attached to these buffers will have rigBufferLen of:
+ def_heap_buf_size.
+ for default RX flow, for rx packet, the bufptr will be def_flow_pkt_rx_offset.
+ for detault RX flow, threshold (ie max # of bytes in buffer) will be:
+ def_heap_buf_size - def_heap_tailroom_size-def_flow_pkt_rx_offset
+
+
+ RX Packet from NetCP
+
+Headroom [Application] Packet [HW] Tailroom [Application] Extra Space [Application]
+<-----------------------><--------------------------><------------------------><----------------------->
+
+Cppi_HostDesc->origBufferLen
+<----------------------------------------------------------------------------->
+Cppi_HostDesc->origBuffPtr
+|
+\/
+|------------def_heap_buf_size-------------------------------------------------|--def_heap_extra_size--|
+| def_flow_pkt_rx_offset| max Cppi_HostDesc->buffLen | def_heap_tailroom_size | Extra Size |
+ ^
+ |
+ Cppi_HostDesc->buffPtr
+
+
+*/
+
+
+/**
+ * @ingroup cfg_constants
+ * @brief This defines the handle to NETCP configuration flow.
+ */
typedef void * NETCP_CFG_FLOW_HANDLE_T;
+
+/**
+ * @ingroup cfg_constants
+ * @def NETCP_DEFAULT_FLOW
+ * This defines the NETCP default FLOW to be NULL.
+ */
#define NETCP_DEFAULT_FLOW (NETCP_CFG_FLOW_HANDLE_T*) NULL
-//NETCP ROUTE
-typedef struct NETCP_CFG_ROUTE_Tag
-{
- NETCP_CFG_FLOW_T * p_flow; //NULL or NETCP_DEFAULT_FLOW for default flow
- PKTIO_HANDLE_T * p_dest_q; //NULL for default destination queue
-} NETCP_CFG_ROUTE_T;
-typedef void * NETCP_CFG_ROUTE_HANDLE_T;
+
+/**
+ * @ingroup cfg_constants
+ * @brief Handle to the default NETCP route.
+ * @details Application to use this handle to identify default NETCP route.
+ */
+typedef void * NETCP_CFG_ROUTE_HANDLE_T;
+
+/**
+ * @def NETCP_DEFAULT_ROUTE
+ * This defines the NETCP default ROUTE to be NULL.
+ */
#define NETCP_DEFAULT_ROUTE (NETCP_CFG_ROUTE_HANDLE_T*) NULL
-/*--------------flow management--------*/
-NETCP_CFG_FLOW_HANDLE_T netcp_cfgAddFlow(NETAPI_T ,
- int n,
- Pktlib_HeapHandle handles[],
- int sizes[], //must be<= heap corresponding heap size-recv_offset-any desired tail room
- int recv_offset, //bytes to save in front of packet
- int * err );
-void netcp_cfgDelFlow(NETAPI_T , NETCP_CFG_FLOW_HANDLE_T , int * err);
+/**
+ * @ingroup cfg_structures
+ * @brief NETCP application defined route information.
+ *
+ */
+typedef struct NETCP_CFG_ROUTE_Tag
+{
+ NETCP_CFG_FLOW_T * p_flow; /**< NULL or NETCP_DEFAULT_FLOW for default flow, @ref NETCP_CFG_FLOW_T */
+ PKTIO_HANDLE_T * p_dest_q; /**<NULL for default destination queue */
+} NETCP_CFG_ROUTE_T;
-/*-----------Actions----------*/
+/**
+ * @ingroup cfg_constants
+ * @def NETCP_CFG_ACTION_DISCARD
+ * This defines the NETCP action to discard packet.
+ */
#define NETCP_CFG_ACTION_DISCARD 0
-#define NETCP_CFG_ACTION_CONTINUE 1 //pass packet on to next classifier
+/**
+ * @ingroup cfg_constants
+ * @def NETCP_CFG_ACTION_CONTINUE
+ * This defines the NETCP action to pass packet ono the next classifier
+ */
+#define NETCP_CFG_ACTION_CONTINUE 1
+/**
+ * @ingroup cfg_constants
+ * @def NETCP_CFG_ACTION_TO_SW
+ * This defines the NETCP action to pass packet to User space application
+ */
#define NETCP_CFG_ACTION_TO_SW 2
-/*------------L2----------------------*/
+
+/**
+ * @ingroup cfg_constants
+ * @brief Handle to the default NETCP route.
+ * @details Application to use this handle to identify default NETCP route.
+ */
typedef void * NETCP_CFG_VLAN_T;
-/******************************************************************/
-/***********************APP ids for rx meta data********************/
-/******************************************************************/
-
-/* APPIDs are present in RX packet meta data and tell "how far the packet got
- through the classification rules of NETCP
- APPID is 32 bits:
- bits 31-24 = MATCH STAGE (NETAPI_NECP_MATCH_xxx below)
- bits 23-8 = identifier (depends on match stage)
- bits 7-0 = logical mac interface
-
- As a cheat sheet:
-If APPID == _NETCP_MATCH_GENERIC_MAC then
- packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID.
- Packet did not match any other rule
-
-If APPID == _NETCP_MATCH_GENERIC_IP then
- packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
- packet matched a generic IP rule attached to that interface. The IP rule # for the interface
- is given in Bytes 3,2 of the APPID. Packet did not match any other rule
-
-If APPID = NETCP_MATCH_CLASS
- packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
- packet matched a generic IP rule attached to that interface OR a general IP rule added as part of
- the classifier or it matched a combination of ISPEC SA rule and a policy check. Finally,
- Packet matched a L4 port rule that was added as part of a classifer. Bytes 3-2
- give the ID of the classifier . Packet did not match any other rule
-
-If APPID = NETCP_MATCH_CLASS_L3 (partial classifier match)
- packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
- packet matched a general IP rule added as part of a classifier. But it not match a
- L4 port or any other rule. We cannout say what classifer partially matched so Bytes 3-2 are
- not applicable
-
-
-If APPID = NETCP_MATCH_IPSEC
- packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
- packet matched an IPSEC SA rule (matched proto, dest ip and SPI). The SA id is in
- bytes 3-2 of APPID. Packet did not match any other rule (so may have failed a policy check)
-
-ID APPID = NETCP_MATCH_IPSEC_POLICY
- packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
- packet matched an IPSEC SA rule (matched proto, dest ip and SPI). Packet matched
- a POLICY RULE - this is a check of the inner IP. The IPSEC RX Policy ID is in
- bytes 3-2 of APPID. Packet did not match any other rule
+/**
+ * @ingroup cfg_constants
+ * @brief AppID for MAC interface
+ */
+typedef uint32_t NETCP_CFG_MACIF_T;
+
+/**
+ * @ingroup cfg_constants
+ * @brief AppID for IP interface
+ */
+typedef uint32_t NETCP_CFG_IP_T;
+
+
+
+/**
+ * @ingroup cfg_constants
+ * @brief This define is used to identify the application id associated with a created SA
+ */
+typedef uint32_t NETCP_CFG_SA_T;
+
+
+/**
+ * @ingroup cfg_constants
+ * @brief AppId used to identify NETCP IPSEC policy
+ */
+typedef uint32_t NETCP_CFG_IPSEC_POLICY_T;
+
+
+/**
+ * @ingroup cfg_constants
+ * @def NETCP_CFG_NO_INTERFACE
+ * This define is to be used in AddIp, AddClassifier to indicate any MAC address.
+ */
+#define NETCP_CFG_NO_INTERFACE 0xff
+
+
+
+/**
+ * @note APPIDs are present in RX packet meta data and tell "how far the packet got
+ * through the classification rules of NETCP
+ * APPID is 32 bits:
+ * bits 31-24 = MATCH STAGE (NETAPI_NECP_MATCH_xxx below)
+ * bits 23-8 = identifier (depends on match stage)
+ * bits 7-0 = logical mac interface
*/
-
-// NWAL "AP ids" for PA Rules that are added
+/**
+ * @ingroup cfg_constants
+ * @def NETAPI_NETCP_MATCH_GENERIC_MAC
+ * This define is used to indicate that apacket matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID.
+ * Packet did not match any other rule
+ */
#define NETAPI_NETCP_MATCH_GENERIC_MAC 0x10000000 //lower byte==interface
+
+/**
+ * @ingroup cfg_constants
+ * @def NETAPI_NETCP_MATCH_GENERIC_IP
+ * This define is used to indicate that a packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
+ * packet matched a generic IP rule attached to that interface. The IP rule # for the interface
+ * is given in Bytes 3,2 of the APPID. Packet did not match any other rule
+ */
#define NETAPI_NETCP_MATCH_GENERIC_IP 0x20000000 //lower byte==interface
+
+
+/**
+ * @ingroup cfg_constants
+ * @def NETAPI_NETCP_MATCH_CLASS
+ * This define is used to indicate that a packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
+ * packet matched a generic IP rule attached to that interface OR a general IP rule added as part of
+ * the classifier or it matched a combination of ISPEC SA rule and a policy check. Finally,
+ * Packet matched a L4 port rule that was added as part of a classifer. Bytes 3-2
+ * give the ID of the classifier . Packet did not match any other rule
+ */
#define NETAPI_NETCP_MATCH_CLASS 0x80000000 //FULL MATCH or' in classifier (16 bits), lower byte==interface
+
+/**
+ * @ingroup cfg_constants
+ * @def NETAPI_NETCP_MATCH_CLASS_L3
+ * This define is used to indicate that a packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
+ * packet matched a general IP rule added as part of a classifier. But it not match a
+ * L4 port or any other rule. We cannout say what classifer partially matched so Bytes 3-2 are
+ * not applicable
+ */
#define NETAPI_NETCP_MATCH_CLASS_L3 0x40000000 //MATCHED L3 but not L4. lower byte==interface
+
+/**
+ * @ingroup cfg_constants
+ * @def NETAPI_NETCP_MATCH_IPSEC
+ * This define is used to indicate that a packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
+ * packet matched an IPSEC SA rule (matched proto, dest ip and SPI). The SA id is in
+ * bytes 3-2 of APPID. Packet did not match any other rule (so may have failed a policy check)
+ */
#define NETAPI_NETCP_MATCH_IPSEC 0x01000000 //lower byte==interface, Or' in SA id (16 bits)
+
+/**
+ * @ingroup cfg_constants
+ * @def NETAPI_NETCP_MATCH_IPSEC_POLICY
+ * This define is used to indicate that a packet matched a MAC entry. Entry # (logical interface) is in byte 0 of APPID
+ * packet matched an IPSEC SA rule (matched proto, dest ip and SPI). Packet matched
+ * a POLICY RULE - this is a check of the inner IP. The IPSEC RX Policy ID is in
+ * bytes 3-2 of APPID. Packet did not match any other rule
+ */
#define NETAPI_NETCP_MATCH_IPSEC_POLICY 0x02000000 //lower byte==interface, Or' in SA id (16 bits)
-/*---------MAC APPID------------------*/
-/* Packets just matching MAC rule are tagged with this type (MATCH_GENERIC_MAC) */
-typedef uint32_t NETCP_CFG_MACIF_T;
-/*---------------IP APPID-------------------*/
-/* Packets whose final match is an IP rule are tagged with this type (MATCH_GENERIC_IP)*/
-typedef uint32_t NETCP_CFG_IP_T;
-/*--------------Tunnel APPID------------------*/
-/* Packets whose final match a IPSEC tunnel are tagged with this type (MATCH_IPSEC)*/
-typedef uint32_t NETCP_CFG_SA_T;
-/*---------------IPSEc RX Policy APPID------------*/
-/* Packets whose final match is a IPSEC RX Policy are tagged with this type (MATCH_IPSEC_POLICY)*/
-typedef uint32_t NETCP_CFG_IPSEC_POLICY_T;
+
+/**
+ * @ingroup cfg_functions
+ * @brief netcp_cfgAddFlow API to add a flow
+ *
+ * @details This api is used to add a flow
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[in] n number of Pktlib_HeapHandle
+ * @param[in] handles[] Handles to Pktlib_HeapHandle
+ * @param[in] sizes[] must be <= heap corresponding heap size-recv_offset-any desired tail room
+ * @param[in] recv_offset bytes to save in front of packet
+ * @param[out] err pointer to error return
+ * @retval NETCP flow handle, @ref NETCP_CFG_FLOW_HANDLE_T
+ * @pre @ref netapi_init
+ */
+NETCP_CFG_FLOW_HANDLE_T netcp_cfgAddFlow(NETAPI_T h,
+ int n,
+ Pktlib_HeapHandle handles[],
+ int sizes[],
+ int recv_offset,
+ int * err );
-//use this in AddIp, AddClassifier to indicate any MAC address
-#define NETCP_CFG_NO_INTERFACE 0xff
+/**
+ * @ingroup cfg_functions
+ * @brief netcp_cfgDelFlow API to delete a flow
+ *
+ * @details This api is used to delete a flow
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[in] p handle to NETCP flow
+ * @param[out] err pointer to error return
+ * @retval none
+ * @pre @ref netapi_init, netcp_cfgAddFlow
+ */
+void netcp_cfgDelFlow(NETAPI_T h ,
+ NETCP_CFG_FLOW_HANDLE_T p ,
+ int * err);
-/* del mac i/f */
+/**
+ * @ingroup cfg_functions
+ * @brief netcp_cfgDelMac API to delete MAC interface
+ *
+ * @details This api is used to delete a MAC interface
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[in] iface_no interface number (0,1,..)
+ * @param[out] err pointer to error return
+ * @retval returned AppID for attached rule. This is returned in RX meta data for packets matching this rule and no other, @ref NETCP_CFG_IP_T
+ * @pre @ref netapi_init , @ref netcp_cfgCreateMacInterface
+ */
void netcp_cfgDelMac(NETAPI_T h,int iface_no, int *err);
-/* del attached IP*/
-void netcp_cfgDelIp(NETAPI_T h, int iface_no, nwal_IpType ipType,
- nwalIpAddr_t * ip_addr,
- nwalIpOpt_t * ip_qualifiers,
- NETCP_CFG_IP_T,
- int *err);
-
-/*****************************************************************
- * Create a MAC interface
- ****************************************************************/
-/*
-* @brief API Creates a MAC interface
- *
- * @details This api is used to create a MAC interface.
- * Once it is created, the MAC interface can be used to receive packets. The API
- * adds a rule to the NETCP 1st level lookup tables to route all packets with destination
- * MAC matching supplied argument and not matching any other lookup entry (see @ref netcp_cfgAddIp) to
- * the supplied route, @ref NETCP_CFG_ROUTE_T, (or default route).
- * Packets arriving that match this rule are identified in meta data with Appid= NETAPI_NETCP_MATCH_GENERIC_MAC
- * Note: The internal SOC switch must be "taught" that this mac
- * address is present by transmitting a packet with destination mac = this interface mac address.
- * @param[in] @ref NETAPI_T: NETAPI instance
- * @param[in] char *: pointer to 6 byte MAC address for interface
- * @param[in] int : interface number (0,1,..)
- * @param[in] int : switch port (0 don't care, 1 switch port 1, 1 switch port 2) [only 0 supported]
- * @param[in] @ref NETCP_CFG_ROUTE_HANDLE_T : [future] handle of a created route or NULL to use internal default route
- * @oaram[in] @ref NETCP_CFG_VLAN_T : [future[ vlan configuration . Set to NULL
- * @param[in] int : [future] interface state (0=down, 1= up)
- * @param[out] int * err: pointer to error return
- * @retval @ref NETCP_CFG_MACIF_T : returned AppID for interface (this is returned in meta data for
- * received packets matching this rule an no others)
- * @pre @ref netapi_init
- */
-NETCP_CFG_MACIF_T netcp_cfgCreateMacInterface(
- NETAPI_T h, //
- uint8_t *p_mac, //mac address associated with interface
- int iface_no, //0,1, ..
- int switch_port,//0=don't care, 1=switch port 1, 2=switch port 2 , ..
- NETCP_CFG_ROUTE_HANDLE_T route, //NULL to use default
- NETCP_CFG_VLAN_T vlan, //future
- int state, //0=down, 1=up //FUTURE
- int * err
- );
-/*****************************************************************
- * Add IP address/qualifier to MAC interface
- ****************************************************************/
-/*
-* @brief API attaches an IP adderess and qualifier to a MAC interface
- *
+/**
+ * @ingroup cfg_functions
+ * @brief API attaches an IP adderess and qualifier to a MAC interface
+ *
* @details This api is used to add an IP address to a MAC interface along
- * with optional IP qualifier. A route, @ref NETCP_CFG_ROUTE_HANDLE_T,or NULL for default
+ * with optional IP qualifier. A route, @ref NETCP_CFG_ROUTE_HANDLE_T,or NULL for default
* may be specified to indicate where to send packets matching the MAC interface MAC address, the
* supplied IP address and any qualifier. This API adds a rule to the NETCP level 1 lookup tables
* Packets arriving that match this rule are identified in meta data with Appid= NETAPI_NETCP_MATCH_GENERIC_IP
- * Note: An IP address must be attached to enable NETCP Recevie Checksum offload feature
- * @param[in] @ref NETAPI_T: NETAPI instance
- * @param[in] int : interface number (0,1,..)
- * @param[in] @ref nwal_IpType : type of IP address (V4 for V6)
- * @oaram[in] @ref nwalIpAddr_t : ip_address
- * @param[in] @ref nwalIpOpt_t : ip_qualifiers (all 0 for no qualifiers). This can be used to apply special handling for
- * diffserv category for example
- * @param[in] @ref NETCP_CFG_ROUTE_HANDLE_T : [future] handle of a created route or NULL to use internal default route
- * @param[out] int * err: pointer to error return
- * @retval @ref NETCP_CFG_IP_T : returned AppID for attached rule. This is returned in RX meta data for
- * packets matching this rule and no other.
- * @pre @ref netapi_init , @ref netcp_cfgAddMac
+ * Note: An IP address must be attached to enable NETCP receive Checksum offload feature
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[in] iface_no interface number (0,1,..)
+ * @param[in] ipType type of IP address (V4 for V6)
+ * @param[in] ip_addr ip_address
+ * @param[in] ip_qualifiers ip_qualifiers (all 0 for no qualifiers). This can be used to apply special handling for
+ * diffserv category for example.
+ * @param[in] route [future] handle of a created route or NULL to use internal default route, @ref NETCP_CFG_ROUTE_HANDLE_T
+ * @param[out] err pointer to error return
+ * @retval returned AppID for attached rule. This is returned in RX meta data for packets matching this rule and no other, @ref NETCP_CFG_IP_T
+ * @pre @ref netapi_init
*/
NETCP_CFG_IP_T netcp_cfgAddIp(
NETAPI_T h,
nwal_IpType ipType,
nwalIpAddr_t * ip_addr,
nwalIpOpt_t * ip_qualifiers,
- NETCP_CFG_ROUTE_HANDLE_T route, //NULL for default
+ NETCP_CFG_ROUTE_HANDLE_T route,
int * err
);
-#define netcp_addIp netcp_cfgAddIp //oops
-/*------------------classification API-------------------*/
+/**
+ * @ingroup cfg_functions
+ * @brief netcp_cfgDelIp API to delete IP interface
+ *
+ * @details This api is used to delete an IP interface
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[in] iface_no interface number (0,1,..)
+ * @param[in] ipType type of IP address (V4 for V6)
+ * @param[in] ip_addr ip_address
+ * @param[in] ip_qualifiers ip_qualifiers (all 0 for no qualifiers). This can be used to apply special handling for
+ * diffserv category for example.
+ * @param[in] ip_rule_id @ref NETCP_CFG_IP_T
+ * @param[out] err pointer to error return
+ * @retval returned AppID for attached rule. This is returned in RX meta data for packets matching this rule and no other, @ref NETCP_CFG_IP_T
+ * @pre @ref netapi_init , @ref netcp_cfgAddIp
+ */
+void netcp_cfgDelIp(NETAPI_T h, int iface_no, nwal_IpType ipType,
+ nwalIpAddr_t * ip_addr,
+ nwalIpOpt_t * ip_qualifiers,
+ NETCP_CFG_IP_T ip_rule_id,
+ int *err);
-//handle to installed classifier returned by API. Pkts matching
-//this classifier will have meta data with this tag. Also used
-//to delete classifier
+
+
+/**
+ * @ingroup cfg_functions
+ * @brief netcp_cfgCreateMacInterface API to create a MAC interface
+ *
+ * @details This api is used to create a MAC interface.
+ * Once it is created, the MAC interface can be used to receive packets. The API
+ * adds a rule to the NETCP 1st level lookup tables to route all packets with destination
+ * MAC matching supplied argument and not matching any other lookup entry (see @ref netcp_cfgAddIp) to
+ * the supplied route, @ref NETCP_CFG_ROUTE_T, (or default route).
+ * Packets arriving that match this rule are identified in meta data with Appid= NETAPI_NETCP_MATCH_GENERIC_MAC
+ * Note: The internal SOC switch must be "taught" that this mac
+ * address is present by transmitting a packet with destination mac = this interface mac address.
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[in] p_mac pointer to 6 byte MAC address for interface
+ * @param[in] iface_no interface number (0,1,..)
+ * @param[in] switch_port (0 don't care, 1 switch port 1, 1 switch port 2) [only 0 supported]
+ * @param[in] route [future] handle of a created route or NULL to use internal default route, @ref NETCP_CFG_ROUTE_HANDLE_T
+ * @param[in] vlan [future[ vlan configuration . Set to NULL, @ref NETCP_CFG_VLAN_T
+ * @param[in] state [future] interface state (0=down, 1= up)
+ * @param[out] err pointer to error return
+ * @retval returns AppID for interface (this is returned in meta data for received packets matching this rule an no others, @ref NETCP_CFG_MACIF_T
+ * @pre @ref netapi_init
+ */
+NETCP_CFG_MACIF_T netcp_cfgCreateMacInterface(
+ NETAPI_T h,
+ uint8_t *p_mac,
+ int iface_no,
+ int switch_port,
+ NETCP_CFG_ROUTE_HANDLE_T route,
+ NETCP_CFG_VLAN_T vlan,
+ int state,
+ int * err
+);
+
+
+/**
+ * @brief This defines handle to installed classifier returned by API. Pkts matching this classifier will have meta data with this tag.
+ * Also used to delete classifier
+ */
typedef uint32_t NETCP_CFG_CLASS_T;
-//classifier L4 type (L2,L3 implied by iface, ip)
+
+/**
+ * @ingroup cfg_structures
+ * @brief NETAPI Class L4 Configuration
+ *
+ * @details This structure contains Class L4 Configuration. L2,L3 implied by iface, ip
+ */
typedef struct NETCP_CFG_CLASS_L4_Tag
{
- //which mac interface pkt is from,
- int iface;
- NETCP_CFG_IP_T ip;
-
- //L4 (port)
- nwal_appProtoType_t proto; //L4 proto (-1 for don't care)
- nwalAppProto_t appProto; //ports or equivalent
+ int iface; /**< Indicates which MAC interface packet is from */
+ NETCP_CFG_IP_T ip; /**< @ref NETCP_CFG_IP_T */
+ nwal_appProtoType_t proto; /**< L4 proto (-1 for don't care)*/
+ nwalAppProto_t appProto; /**< Ports or equivalent */
} NETCP_CFG_CLASS_L4_T;
+
+/**
+ * @ingroup cfg_structures
+ * @brief NETAPI Classifier L4 plus IPSEC policy configuration
+ *
+ * @details This structure contains Class L4 plus IPSEC policy configuration. L2,L3 implied by iface, ip
+ */
//classifier L4 + policy (L2, L3 (outer), tunnel, L3 (inner) implied by policy
typedef struct NETCP_CFG_CLASS_L4_IPSEC_Tag
{
- //which mac interface pkt is from,
- int iface;
- NETCP_CFG_IPSEC_POLICY_T ip_policy;
-
- //L4 (port)
- nwal_appProtoType_t proto; //L4 proto (-1 for don't care)
- nwalAppProto_t appProto; //ports or equivalent
+ int iface; /**< Indicates which MAC interface packet is from */
+ NETCP_CFG_IPSEC_POLICY_T ip_policy; /**< IPSEC policy configuration */
+ nwal_appProtoType_t proto; /**< L4 proto (-1 for don't care)*/
+ nwalAppProto_t appProto; /**< Ports or equivalent */
} NETCP_CFG_CLASS_L4_IPSEC_T;
-//classifier L3_L4 type (L2 implied by iface)
+
+
+/**
+ * @ingroup cfg_structures
+ * @brief NETAPI Classifier L4/L3 configuration
+ *
+ * @details This structure contains Class L4 and Class L3 configuration. L2 implied by iface
+ */
typedef struct NETCP_CFG_CLASS_L3_L4_Tag
{
- //which mac interface pkt is from,
- int iface;
-
- //L3 - iP address: IP type, destination addr, qualifiers
- nwal_IpType ipType;
- nwalIpAddr_t * ip_addr;
- nwalIpOpt_t * ip_qualifiers;
- NETCP_CFG_ROUTE_HANDLE_T p_fail_route; //what to do if L3 matches but L4 fails AND L3 is a
- // new rule.(if exisitng rule, then existing fail
- //route will be used.
-
- //L4 (port)
- nwal_appProtoType_t proto; //L4 proto (-1 for don't care)
- nwalAppProto_t appProto; //ports or equivalent
-
+ int iface; /**< Indicates which MAC interface packet is from */
+ nwal_IpType ipType; /**< IP address type, IPV4 or IPV6 */
+ nwalIpAddr_t * ip_addr; /**< IP addres */
+ nwalIpOpt_t * ip_qualifiers;/**< IP address qualifiers */
+ NETCP_CFG_ROUTE_HANDLE_T p_fail_route; /**< What to do if L3 matches but L4 fails AND L3 is a
+ * new rule.(if exisitng rule, then existing fail
+ *route will be used. */
+ nwal_appProtoType_t proto; /**< L4 proto (-1 for don't care)*/
+ nwalAppProto_t appProto; /**< Ports or equivalent */
} NETCP_CFG_CLASS_L3_L4_T;
-//classifier
+/**
+ * @ingroup cfg_structures
+ * @brief NETAPI Classifier configuration
+ *
+ * @details This structure contains the NETAPI classifer configuration
+ */
typedef struct NETCP_CFG_CLASSIFIER_Tag
{
- int classType;
+
+/**
+ * Classifer type which can be set to one of the following defines:
+ * <br>
+ * @ref NETCP_CFG_CLASS_TYPE_L4 , @ref NETCP_CFG_CLASS_TYPE_L3_L4
+ */
+ int classType;
+
+/**
+ * @def NETCP_CFG_CLASS_TYPE_L4
+ * @ingroup cfg_constants
+ * This defines classifier type to be Class L4 TBD
+ */
#define NETCP_CFG_CLASS_TYPE_L4 0
+
+/**
+ * @def NETCP_CFG_CLASS_TYPE_L3_L4
+ * @ingroup cfg_constants
+ * This defines classifier type to be Class L4/L3 TBD
+ */
#define NETCP_CFG_CLASS_TYPE_L3_L4 1
- union
- {
- NETCP_CFG_CLASS_L3_L4_T c_l3_l4;
- NETCP_CFG_CLASS_L4_T c_l4;
- NETCP_CFG_CLASS_L4_IPSEC_T c_l4_ipsec;
- } u;
+ union
+ {
+ NETCP_CFG_CLASS_L3_L4_T c_l3_l4; /**< @ref NETCP_CFG_CLASS_L3_L4_T */
+ NETCP_CFG_CLASS_L4_T c_l4; /**< @ref NETCP_CFG_CLASS_L4_T */
+ NETCP_CFG_CLASS_L4_IPSEC_T c_l4_ipsec; /**< @ref NETCP_CFG_CLASS_L4_IPSEC_T */
+ } u; /**< union for classifier type configuration structure */
} NETCP_CFG_CLASSIFIER_T;
-//Instert a classifier.
-NETCP_CFG_CLASS_T netcp_cfgAddClass(NETAPI_T h,
+
+
+/**
+ * @ingroup cfg_functions
+ * @brief netcp_cfgAddClass API can be used to route a packet flow to a specific PKTIO channel
+ *
+ * @details This api can be used to route a packet flow to a particular PktIO channel, use a specific
+ * pktLib heap, and/or have NetCP attach a tag (classifier id) to the incoming packet.
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[in] p_class
+ * @param[in] p_route
+ * @param[in] action
+ * @param[out] err pointer to error return
+ * @retval returned AppID for attached rule. This is returned in RX meta data for packets matching this rule and no other, @ref NETCP_CFG_IP_T
+ * @pre @ref netapi_init
+ */NETCP_CFG_CLASS_T netcp_cfgAddClass(NETAPI_T h,
NETCP_CFG_CLASSIFIER_T *p_class,
NETCP_CFG_ROUTE_HANDLE_T p_route,
- int action, int * err);
-//delete classifier
-void netcp_cfgDelClass(NETAPI_T h,
- NETCP_CFG_CLASS_T classId,
- int *err);
+ int action,
+ int * err);
-/***************************************************************************
-********************************STATS**************************************
-**************************************************************************/
+/**
+ * @ingroup cfg_functions
+ * @brief netcp_cfgDelClass API can be used to delete a preconfigured classifier
+ *
+ * @details This API can be used to delete a preconfigured classifier
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[in] classId
+ * @param[out] err pointer to error return
+ * @retval none
+ * @pre @ref netapi_init, @ref netcp_cfgAddClass
+ */
+void netcp_cfgDelClass(NETAPI_T h,
+ NETCP_CFG_CLASS_T classId,
+ int *err);
+
-/*
- * @brief This is the callback function that is used to return statistics from NETCP
- *
+/**
+ * @ingroup netapi_cb_functions
+ * @brief NETCP_CFG_STATS_CB Callback function that is used to return statistics from NETCP
+ *
* @details The application provides a callback function that NETAPI uses to report statistics.
-* The request for stats is generated from the @ref netcp_cfgReqStats API.
- * Note: to receive ths stats callback, the @ref netapi_netcpPoll funcition must be called
- * @param[in] @ref NETAPI_T: NETAPI instance
- * @param[in] @ref paSysStats_t * : the PA (NETCP packet accelerator subsystem) statistics block
+ * The request for stats is generated from the @ref netcp_cfgReqStats API.
+ * Note: to receive ths stats callback, the @ref netapi_netcpPoll funcition must be called
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[out] pPaStats the PA (NETCP packet accelerator subsystem) statistics block
* @retval none
- * @pre @ref netapi_init , @ref netapi_cfgReqStats, @ref netapi_netcpPoll
+ * @pre @ref netapi_init , @ref netcp_cfgReqStats, @ref netapi_netcpPoll
*/
-//stats CB
-typedef void (*NETCP_CFG_STATS_CB)( NETAPI_T h, paSysStats_t* pPaStats);
+typedef void (*NETCP_CFG_STATS_CB)(NETAPI_T h,
+ paSysStats_t* pPaStats);
-
-//stats request
-/*
- * @brief API request statistics from NETCP
- *
+/**
+ * @ingroup cfg_functions
+ * @brief netcp_cfgReqStats API to request statistics from NETCP
+ *
* @details This api is used to request a statistics from NETCP. This will generate a stats request
- * command to NETCP. Sometime later, the statistics result will arrive and will be passed to
- * the caller via the asynchronus callback @ref NETCP_CFG_STATS_CB that is registered in this call.
- * Note: to receive the stats callback, the @ref netapi_netcpPoll funcition must be called
- * @param[in] @ref NETAPI_T: NETAPI instance
- * @param[in] @ref NETCP_CFG_STATS_CB : the function to call with the resulting statistics block
- * @param[in] int : clear the stats in NETCP after the report (0=no, 1=yes)
- * @param[out] int * err: pointer to error return
+ * command to NETCP. Sometime later, the statistics result will arrive and will be passed to
+ * the caller via the asynchronus callback @ref NETCP_CFG_STATS_CB that is registered in this call.
+ * Note: to receive the stats callback, the @ref netapi_netcpPoll funcition must be called
+ * @param[in] h NETAPI instance handle, @ref NETAPI_T
+ * @param[in] cb the callback function to invoke with the resulting statistics block, @ref NETCP_CFG_STATS_CB
+ * @param[in] doClear clear the stats in NETCP after the report (0=no, 1=yes)
+ * @param[out] err pointer to error return
* @retval none
* @pre @ref netapi_init
*/
-void netcp_cfgReqStats(NETAPI_T h, //NEAPI instance
- NETCP_CFG_STATS_CB c, //stats report callback function
- int doClear, //0: don't clear, 1 clear
+void netcp_cfgReqStats(NETAPI_T h,
+ NETCP_CFG_STATS_CB cb,
+ int doClear,
int *err);
+
+
#endif