Merge "[qca-nss-drv] Frequency logging."
diff --git a/Makefile b/Makefile
index 01d762d..12505a1 100644
--- a/Makefile
+++ b/Makefile
@@ -29,9 +29,12 @@
nss_gre.o \
nss_gre_stats.o \
nss_gre_redir.o \
+ nss_gre_redir_log.o \
nss_gre_redir_lag_ds.o \
+ nss_gre_redir_lag_ds_log.o \
nss_gre_redir_lag_ds_stats.o \
nss_gre_redir_lag_us.o \
+ nss_gre_redir_lag_us_log.o \
nss_gre_redir_lag_us_stats.o \
nss_gre_redir_stats.o \
nss_gre_tunnel.o \
@@ -50,22 +53,26 @@
nss_ipv6_reasm.o \
nss_ipv6_reasm_stats.o \
nss_l2tpv2.o \
+ nss_l2tpv2_log.o \
nss_l2tpv2_stats.o \
nss_lag.o \
nss_log.o \
nss_lso_rx.o \
nss_lso_rx_stats.o \
nss_map_t.o \
+ nss_map_t_log.o \
nss_map_t_stats.o \
nss_meminfo.o \
nss_n2h.o \
nss_n2h_stats.o \
nss_oam.o \
+ nss_oam_log.o \
nss_phys_if.o \
nss_pm.o \
nss_profiler.o \
nss_project.o \
nss_portid.o \
+ nss_portid_log.o \
nss_portid_stats.o \
nss_ppe.o \
nss_ppe_stats.o \
@@ -83,6 +90,7 @@
nss_tstamp.o \
nss_tun6rd.o \
nss_trustsec_tx.o \
+ nss_trustsec_tx_log.o \
nss_trustsec_tx_stats.o \
nss_tunipip6.o \
nss_virt_if.o \
@@ -118,7 +126,8 @@
nss_hal/ipq807x/nss_hal_pvt.o \
nss_dtls_cmn.o \
nss_dtls_cmn_log.o \
- nss_crypto_cmn.o
+ nss_crypto_cmn.o \
+ nss_crypto_cmn_log.o
ccflags-y += -I$(obj)/nss_hal/ipq807x -DNSS_HAL_IPQ807x_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT
endif
diff --git a/Makefile.fsm b/Makefile.fsm
index 04cc2a5..c357737 100644
--- a/Makefile.fsm
+++ b/Makefile.fsm
@@ -27,6 +27,7 @@
nss_gre.o \
nss_gre_stats.o \
nss_gre_redir.o \
+ nss_gre_redir_log.o \
nss_gre_redir_stats.o \
nss_gre_tunnel.o \
nss_gre_tunnel_stats.o \
@@ -44,20 +45,24 @@
nss_ipv6_reasm.o \
nss_ipv6_reasm_stats.o \
nss_l2tpv2.o \
+ nss_l2tpv2_log.o \
nss_l2tpv2_stats.o \
nss_lag.o \
nss_log.o \
nss_lso_rx.o \
nss_lso_rx_stats.o \
nss_map_t.o \
+ nss_map_t_log.o \
nss_map_t_stats.o \
nss_n2h.o \
nss_n2h_stats.o \
nss_oam.o \
+ nss_oam_log.o \
nss_phys_if.o \
nss_pm.o \
nss_profiler.o \
nss_portid.o \
+ nss_portid_log.o \
nss_portid_stats.o \
nss_ppe.o \
nss_ppe_stats.o \
@@ -73,6 +78,7 @@
nss_tstamp.o \
nss_tun6rd.o \
nss_trustsec_tx.o \
+ nss_trustsec_tx_log.o \
nss_trustsec_tx_stats.o \
nss_tunipip6.o \
nss_virt_if.o \
diff --git a/exports/nss_dynamic_interface.h b/exports/nss_dynamic_interface.h
index 21bf200..3a23af6 100644
--- a/exports/nss_dynamic_interface.h
+++ b/exports/nss_dynamic_interface.h
@@ -52,10 +52,10 @@
NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_2,
NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE,
NSS_DYNAMIC_INTERFACE_TYPE_VLAN,
- NSS_DYNAMIC_INTERFACE_TYPE_GRE,
- NSS_DYNAMIC_INTERFACE_TYPE_WIFILI,
NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_3,
+ NSS_DYNAMIC_INTERFACE_TYPE_WIFILI,
NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_4,
+ NSS_DYNAMIC_INTERFACE_TYPE_RESERVED_5,
NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER,
NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_OUTER,
NSS_DYNAMIC_INTERFACE_TYPE_DTLS_CMN_INNER,
@@ -75,6 +75,8 @@
NSS_DYNAMIC_INTERFACE_TYPE_GRE_TUNNEL_INNER_EXCEPTION,
NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_US,
NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_EXCEPTION_DS,
+ NSS_DYNAMIC_INTERFACE_TYPE_GRE_INNER,
+ NSS_DYNAMIC_INTERFACE_TYPE_GRE_OUTER,
NSS_DYNAMIC_INTERFACE_TYPE_MAX
};
diff --git a/exports/nss_gre.h b/exports/nss_gre.h
index 9ff8de8..1e49c48 100644
--- a/exports/nss_gre.h
+++ b/exports/nss_gre.h
@@ -71,8 +71,10 @@
* Message types for GRE requests and responses.
*/
enum nss_gre_msg_types {
- NSS_GRE_MSG_CONFIGURE = NSS_IF_MAX_MSG_TYPES + 1,
- NSS_GRE_MSG_DECONFIGURE,
+ NSS_GRE_MSG_ENCAP_CONFIGURE = NSS_IF_MAX_MSG_TYPES + 1,
+ NSS_GRE_MSG_DECAP_CONFIGURE,
+ NSS_GRE_MSG_ENCAP_DECONFIGURE,
+ NSS_GRE_MSG_DECAP_DECONFIGURE,
NSS_GRE_MSG_SESSION_STATS,
NSS_GRE_MSG_BASE_STATS,
NSS_GRE_MSG_MAX
@@ -152,6 +154,7 @@
uint32_t mode; /**< GRE TUN or TAP. */
uint32_t ip_type; /**< IPv4 or IPv6 type. */
uint32_t next_node_if_num; /**< To whom to forward packets. */
+ uint32_t sibling_if_num; /**< Sibling interface number. */
uint16_t src_mac[3]; /**< Source MAC address. */
uint16_t dest_mac[3]; /**< Destination MAC address. */
uint8_t ttl; /**< TTL or HOPLIMIT. */
@@ -308,6 +311,7 @@
* net_device
*
* @param[in] if_num NSS interface number.
+ * @param[in] type NSS interface type.
* @param[in] gre_callback Callback for the data.
* @param[in] msg_callback Callback for the message.
* @param[in] netdev Pointer to the associated network device.
@@ -316,7 +320,7 @@
* @return
* Pointer to the NSS core context.
*/
-extern struct nss_ctx_instance *nss_gre_register_if(uint32_t if_num, nss_gre_data_callback_t gre_callback,
+extern struct nss_ctx_instance *nss_gre_register_if(uint32_t if_num, uint32_t type, nss_gre_data_callback_t gre_callback,
nss_gre_msg_callback_t msg_callback, struct net_device *netdev, uint32_t features);
/**
diff --git a/exports/nss_if.h b/exports/nss_if.h
index cd9b26e..853f9bd 100644
--- a/exports/nss_if.h
+++ b/exports/nss_if.h
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -47,6 +47,7 @@
NSS_IF_PAUSE_ON_OFF,
NSS_IF_VSI_ASSIGN,
NSS_IF_VSI_UNASSIGN,
+ NSS_IF_SET_NEXTHOP,
NSS_IF_MAX_MSG_TYPES = 9999,
};
@@ -176,6 +177,14 @@
};
/**
+ * nss_if_set_nexthop
+ * Message to set nexthop for an interface.
+ */
+struct nss_if_set_nexthop {
+ uint32_t nexthop; /**< Nexthop interface number. */
+};
+
+/**
* nss_if_msgs
* Information for physical NSS interface command messages.
*/
@@ -204,6 +213,8 @@
/**< Assign the VSI. */
struct nss_if_vsi_unassign vsi_unassign;
/**< Remove the VSI assignment. */
+ struct nss_if_set_nexthop set_nexthop;
+ /**< Set nexthop of interface. */
};
/**
@@ -299,6 +310,22 @@
nss_tx_status_t nss_if_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_if_msg *nim);
/**
+ * nss_phys_if_set_nexthop
+ * Configure nexthop for an interface.
+ *
+ * @datatypes
+ * nss_ctx_instance
+ *
+ * @param[in] nss_ctx Pointer to the NSS context.
+ * @param[in] if_num Network physical or virtual interface number.
+ * @param[in] nexthop Network physical or virtual interface number.
+ *
+ * @return
+ * Status of the Tx operation.
+ */
+nss_tx_status_t nss_phys_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop);
+
+/**
* @}
*/
diff --git a/exports/nss_wifili_if.h b/exports/nss_wifili_if.h
index 449fe26..5ce8daa 100644
--- a/exports/nss_wifili_if.h
+++ b/exports/nss_wifili_if.h
@@ -745,6 +745,7 @@
uint32_t tx_success_bytes; /**< Total number of bytes sent successfully. */
uint32_t tx_nawds_mcast_cnt; /**< Total number of NAWDS multicast packets sent. */
uint32_t tx_nawds_mcast_bytes; /**< Total number of NAWDS multicast bytes sent. */
+ uint32_t transmit_cnt; /**< Total number of frames transmitted. */
};
/**
diff --git a/nss_core.c b/nss_core.c
index a83bc22..530703d 100644
--- a/nss_core.c
+++ b/nss_core.c
@@ -1462,7 +1462,7 @@
*/
nss_assert(if_map->magic == DEV_MAGIC);
- nss_ctx->c2c_start = if_map->c2c_start;
+ nss_ctx->c2c_start = nss_ctx->meminfo_ctx.c2c_start_dma;
nss_top = nss_ctx->nss_top;
spin_lock_bh(&nss_top->lock);
diff --git a/nss_core.h b/nss_core.h
index 70471c7..1d3e170 100644
--- a/nss_core.h
+++ b/nss_core.h
@@ -623,8 +623,10 @@
/* map-t interface event callback function */
nss_gre_msg_callback_t gre_msg_callback;
/* gre interface event callback function */
- nss_gre_data_callback_t gre_data_callback;
- /* gre data callback function */
+ nss_gre_data_callback_t gre_inner_data_callback;
+ /* gre inner data callback function */
+ nss_gre_data_callback_t gre_outer_data_callback;
+ /* gre outer data callback function */
nss_tunipip6_msg_callback_t tunipip6_msg_callback;
/* ipip6 tunnel interface event callback function */
nss_pptp_msg_callback_t pptp_msg_callback;
diff --git a/nss_crypto_cmn.c b/nss_crypto_cmn.c
index cf5dfb4..a53afe0 100644
--- a/nss_crypto_cmn.c
+++ b/nss_crypto_cmn.c
@@ -21,6 +21,7 @@
#include "nss_tx_rx_common.h"
#include "nss_crypto_cmn.h"
+#include "nss_crypto_cmn_log.h"
/*
* Amount time the synchronous message should wait for response from
@@ -89,6 +90,11 @@
nss_core_log_msg_failures(nss_ctx, ncm);
/*
+ * Trace messages.
+ */
+ nss_crypto_cmn_log_rx_msg(nim);
+
+ /*
* Load, Test & call
*/
cb = (nss_crypto_cmn_msg_callback_t)ncm->cb;
@@ -131,6 +137,11 @@
nss_ctx, ncm->version, ncm->interface, ncm->type,
(void *)ncm->cb, (void *)ncm->app_data, ncm->len);
+ /*
+ * Trace messages.
+ */
+ nss_crypto_cmn_log_tx_msg(msg);
+
return nss_core_send_cmd(nss_ctx, msg, sizeof(*msg), NSS_NBUF_PAYLOAD_SIZE);
}
EXPORT_SYMBOL(nss_crypto_cmn_tx_msg);
diff --git a/nss_crypto_cmn_log.c b/nss_crypto_cmn_log.c
new file mode 100644
index 0000000..ed44f3c
--- /dev/null
+++ b/nss_crypto_cmn_log.c
@@ -0,0 +1,202 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_crypto_cmn_log.c
+ * NSS Crypto Common logger file.
+ */
+
+#include "nss_core.h"
+
+/*
+ * nss_crypto_cmn_log_message_types_str
+ * Crypto Common message strings
+ */
+static int8_t *nss_crypto_cmn_log_message_types_str[NSS_CRYPTO_CMN_MSG_TYPE_MAX] __maybe_unused = {
+ "Crypto Common Invalid Message",
+ "Crypto Common CRYPTO CMN Initialize Node",
+ "Crypto Common Initialize Engine",
+ "Crypto Common Initialize DMA Pair",
+ "Crypto Common Update Context Information",
+ "Crypto Common Clear Context Information",
+ "Crypto Common Verify Context Active",
+ "Crypto Common Synchronous Node Statistics"
+ "Crypto Common Synchronouts Engine Statistics",
+ "Crypto Common Synchronous Context Statistics"
+};
+
+/*
+ * nss_crypto_cmn_log_error_response_types_str
+ * Strings for error types for crypto common messages
+ */
+static int8_t *nss_crypto_cmn_log_error_response_types_str[NSS_CRYPTO_CMN_MSG_ERROR_MAX] __maybe_unused = {
+ "Crypto Common No Error",
+ "Crypto Common Header Version Not Supported",
+ "Crypto Common Context Index out-of-range for node",
+ "Crypto Common DMA mask out-of-range",
+ "Crypto Common DMA count exceeds Token",
+ "Crypto Common Token Allocation failed",
+ "Crypto Common Context Index out-of-range",
+ "Crypto Common Context has references",
+ "Crypto Common Bad Context Size",
+ "Crypto Common Bad Algorithm",
+ "Crypto Common Context Allocation failed",
+ "Crypto Common Context has no references",
+ "Crypto Common Invalid Context Flags"
+};
+
+/*
+ * nss_crypto_cmn_node_msg()
+ * Log NSS crypto common node message.
+ */
+static void nss_crypto_cmn_node_msg(struct nss_crypto_cmn_msg *ncm)
+{
+ struct nss_crypto_cmn_node *ncnm __maybe_unused = &ncm->msg.node;
+ nss_trace("%p: NSS crypto common node message:\n"
+ "Crypto Common Max DMA Rings: %d\n"
+ "Crypto Common Max Contex: %d\n"
+ "Crypto Common Max Context Size: %d\n",
+ ncnm, ncnm->max_dma_rings,
+ ncnm->max_ctx, ncnm->max_ctx_size);
+}
+
+/*
+ * nss_crypto_cmn_engine_msg()
+ * Log NSS crypto cmn engine message.
+ */
+static void nss_crypto_cmn_engine_msg(struct nss_crypto_cmn_msg *ncm)
+{
+ struct nss_crypto_cmn_engine *ncem __maybe_unused = &ncm->msg.eng;
+ nss_trace("%p: NSS crypto common engine message \n"
+ "Crypto Common Firmware Version: %p\n"
+ "Crypto Common DMA Mask: %x\n"
+ "Crypto Common Token Count: %d\n",
+ ncem, &ncem->fw_ver,
+ ncem->dma_mask, ncem->req_count);
+}
+
+/*
+ * nss_crypto_cmn_dma_msg()
+ * Log NSS crypto cmn dma message.
+ */
+static void nss_crypto_cmn_dma_msg(struct nss_crypto_cmn_msg *ncm)
+{
+ struct nss_crypto_cmn_dma *ncdm __maybe_unused = &ncm->msg.dma;
+ nss_trace("%p: NSS crypto common dma message \n"
+ "Crypto Common DMA Pair ID: %d\n",
+ ncdm, ncdm->pair_id);
+}
+
+/*
+ * nss_crypto_cmn_ctx_msg()
+ * Log NSS crypto cmn context message.
+ */
+static void nss_crypto_cmn_ctx_msg(struct nss_crypto_cmn_msg *ncm)
+{
+ struct nss_crypto_cmn_ctx *nccm __maybe_unused = &ncm->msg.ctx;
+ nss_trace("%p: NSS crypto common context message \n"
+ "Crypto Common Context Spare Words: %p\n"
+ "Crypto Common Index: %d\n"
+ "Crypto Common Secure Offset: %d\n"
+ "Crypto Common Cipher Key: %p\n"
+ "Crypto Common Authorization Key: %p\n"
+ "Crypto Common Nonce Value: %p\n"
+ "Crypto Common Algorithm: %x\n"
+ "Crypto Common Context Specific Flags: %x\n",
+ nccm, &nccm->spare,
+ nccm->index, nccm->sec_offset,
+ &nccm->cipher_key, &nccm->auth_key,
+ &nccm->nonce, nccm->algo, nccm->flags);
+}
+
+/*
+ * nss_crypto_cmn_log_verbose()
+ * Log message contents.
+ */
+static void nss_crypto_cmn_log_verbose(struct nss_crypto_cmn_msg *ncm)
+{
+ switch (ncm->cm.type) {
+ case NSS_CRYPTO_CMN_MSG_TYPE_SETUP_NODE:
+ nss_crypto_cmn_node_msg(ncm);
+ break;
+
+ case NSS_CRYPTO_CMN_MSG_TYPE_SETUP_ENG:
+ nss_crypto_cmn_engine_msg(ncm);
+ break;
+
+ case NSS_CRYPTO_CMN_MSG_TYPE_SETUP_DMA:
+ nss_crypto_cmn_dma_msg(ncm);
+ break;
+
+ case NSS_CRYPTO_CMN_MSG_TYPE_SETUP_CTX:
+ nss_crypto_cmn_ctx_msg(ncm);
+ break;
+
+ default:
+ nss_warning("%p: Invalid message type\n", ncm);
+ break;
+ }
+}
+
+/*
+ * nss_crypto_cmn_log_tx_msg()
+ * Log messages transmitted to FW.
+ */
+void nss_crypto_cmn_log_tx_msg(struct nss_crypto_cmn_msg *ncm)
+{
+ if (ncm->cm.type >= NSS_CRYPTO_CMN_MSG_TYPE_MAX) {
+ nss_warning("%p: Invalid message type\n", ncm);
+ return;
+ }
+
+ nss_info("%p: type[%d]:%s\n", ncm, ncm->cm.type, nss_crypto_cmn_log_message_types_str[ncm->cm.type]);
+ nss_crypto_cmn_log_verbose(ncm);
+}
+
+/*
+ * nss_crypto_cmn_log_rx_msg()
+ * Log messages received from FW.
+ */
+void nss_crypto_cmn_log_rx_msg(struct nss_crypto_cmn_msg *ncm)
+{
+ if (ncm->cm.response >= NSS_CMN_RESPONSE_LAST) {
+ nss_warning("%p: Invalid response\n", ncm);
+ return;
+ }
+
+ if (ncm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ncm->cm.response == NSS_CMN_RESPONSE_ACK)) {
+ nss_info("%p: type[%d]:%s, response[%d]:%s\n", ncm, ncm->cm.type,
+ nss_crypto_cmn_log_message_types_str[ncm->cm.type],
+ ncm->cm.response, nss_cmn_response_str[ncm->cm.response]);
+ goto verbose;
+ }
+
+ if (ncm->cm.error >= NSS_CRYPTO_CMN_MSG_ERROR_MAX) {
+ nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n",
+ ncm, ncm->cm.type, nss_crypto_cmn_log_message_types_str[ncm->cm.type],
+ ncm->cm.response, nss_cmn_response_str[ncm->cm.response],
+ ncm->cm.error);
+ goto verbose;
+ }
+
+ nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n",
+ ncm, ncm->cm.type, nss_crypto_cmn_log_message_types_str[ncm->cm.type],
+ ncm->cm.response, nss_cmn_response_str[ncm->cm.response],
+ ncm->cm.error, nss_crypto_cmn_log_error_response_types_str[ncm->cm.error]);
+
+verbose:
+ nss_crypto_cmn_log_verbose(ncm);
+}
diff --git a/nss_crypto_cmn_log.h b/nss_crypto_cmn_log.h
new file mode 100644
index 0000000..f78a8ec
--- /dev/null
+++ b/nss_crypto_cmn_log.h
@@ -0,0 +1,37 @@
+/*
+ ******************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * ****************************************************************************
+ */
+
+#ifndef __NSS_CRYPTO_CMN_LOG_H__
+#define __NSS_CRYPTO_CMN_LOG_H__
+
+/*
+ * nss_crypto_cmn_log.h
+ * NSS Crypto Common Log header file.
+ */
+
+/*
+ * nss_crypto_cmn_log_tx_msg
+ * Logs a crypto common message that is sent to the NSS firmware.
+ */
+void nss_crypto_cmn_log_tx_msg(struct nss_crypto_cmn_msg *ncm);
+
+/*
+ * nss_crypto_cmn_log_rx_msg
+ * Logs a crypto common message that is received from the NSS firmware.
+ */
+void nss_crypto_cmn_log_rx_msg(struct nss_crypto_cmn_msg *ncm);
+
+#endif /* __NSS_CRYPTO_CMN_LOG_H__ */
diff --git a/nss_gre.c b/nss_gre.c
index e262154..fb510e0 100644
--- a/nss_gre.c
+++ b/nss_gre.c
@@ -33,10 +33,10 @@
static atomic64_t pkt_cb_addr = ATOMIC64_INIT(0);
/*
- * nss_gre_rx_handler()
- * GRE rx handler.
+ * nss_gre_inner_rx_handler()
+ * GRE inner rx handler.
*/
-static void nss_gre_rx_handler(struct net_device *dev, struct sk_buff *skb,
+static void nss_gre_inner_rx_handler(struct net_device *dev, struct sk_buff *skb,
__attribute__((unused)) struct napi_struct *napi)
{
nss_gre_data_callback_t cb;
@@ -49,7 +49,28 @@
}
}
- cb = nss_top_main.gre_data_callback;
+ cb = nss_top_main.gre_inner_data_callback;
+ cb(dev, skb, 0);
+}
+
+/*
+ * nss_gre_outer_rx_handler()
+ * GRE outer rx handler.
+ */
+static void nss_gre_outer_rx_handler(struct net_device *dev, struct sk_buff *skb,
+ __attribute__((unused)) struct napi_struct *napi)
+{
+ nss_gre_data_callback_t cb;
+
+ nss_gre_pkt_callback_t scb = (nss_gre_pkt_callback_t)(unsigned long)atomic64_read(&pkt_cb_addr);
+ if (unlikely(scb)) {
+ struct nss_gre_info *info = (struct nss_gre_info *)netdev_priv(dev);
+ if (likely(info->next_dev)) {
+ scb(info->next_dev, skb);
+ }
+ }
+
+ cb = nss_top_main.gre_outer_data_callback;
cb(dev, skb, 0);
}
@@ -255,7 +276,7 @@
* nss_gre_register_if()
* Register data and message handlers for GRE.
*/
-struct nss_ctx_instance *nss_gre_register_if(uint32_t if_num, nss_gre_data_callback_t data_callback,
+struct nss_ctx_instance *nss_gre_register_if(uint32_t if_num, uint32_t type, nss_gre_data_callback_t data_callback,
nss_gre_msg_callback_t event_callback, struct net_device *netdev, uint32_t features)
{
struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.gre_handler_id];
@@ -263,10 +284,25 @@
nss_assert(nss_ctx);
nss_assert(nss_is_dynamic_interface(if_num));
- nss_core_register_subsys_dp(nss_ctx, if_num, nss_gre_rx_handler, NULL, netdev, netdev, features);
+ switch (type) {
+ case NSS_DYNAMIC_INTERFACE_TYPE_GRE_INNER:
+ nss_core_register_subsys_dp(nss_ctx, if_num, nss_gre_inner_rx_handler, NULL, netdev, netdev, features);
+ nss_top_main.gre_inner_data_callback = data_callback;
+ break;
+
+ case NSS_DYNAMIC_INTERFACE_TYPE_GRE_OUTER:
+ nss_core_register_subsys_dp(nss_ctx, if_num, nss_gre_outer_rx_handler, NULL, netdev, netdev, features);
+ nss_top_main.gre_outer_data_callback = data_callback;
+ break;
+
+ default:
+ nss_warning("%p: Unable to register. Wrong interface type %d\n", nss_ctx, type);
+ return NULL;
+ }
+
+ nss_core_set_subsys_dp_type(nss_ctx, netdev, if_num, type);
nss_top_main.gre_msg_callback = event_callback;
- nss_top_main.gre_data_callback = data_callback;
nss_core_register_handler(nss_ctx, if_num, nss_gre_msg_handler, NULL);
@@ -283,12 +319,19 @@
void nss_gre_unregister_if(uint32_t if_num)
{
struct nss_ctx_instance *nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.gre_handler_id];
+ struct net_device *dev;
nss_assert(nss_ctx);
nss_assert(nss_is_dynamic_interface(if_num));
- nss_core_unregister_subsys_dp(nss_ctx, if_num);
+ dev = nss_cmn_get_interface_dev(nss_ctx, if_num);
+ if (!dev) {
+ nss_warning("%p: Unable to find net device for the interface %d\n", nss_ctx, if_num);
+ return;
+ }
+ nss_core_unregister_subsys_dp(nss_ctx, if_num);
+ nss_core_set_subsys_dp_type(nss_ctx, dev, if_num, NSS_DYNAMIC_INTERFACE_TYPE_NONE);
nss_top_main.gre_msg_callback = NULL;
nss_core_unregister_handler(nss_ctx, if_num);
diff --git a/nss_gre_redir.c b/nss_gre_redir.c
index c899873..967aa27 100644
--- a/nss_gre_redir.c
+++ b/nss_gre_redir.c
@@ -16,6 +16,7 @@
#include "nss_tx_rx_common.h"
#include "nss_gre_redir_stats.h"
+#include "nss_gre_redir_log.h"
#define NSS_GRE_REDIR_TX_TIMEOUT 3000 /* 3 Seconds */
static struct dentry *gre_redir_dentry;
@@ -171,6 +172,11 @@
ncm->interface != NSS_GRE_REDIR_INTERFACE);
/*
+ * Trace Messages
+ */
+ nss_gre_redir_log_rx_msg(ngrm);
+
+ /*
* Is this a valid request/response packet?
*/
if (ncm->type >= NSS_GRE_REDIR_MAX_MSG_TYPES) {
@@ -496,6 +502,11 @@
struct nss_cmn_msg *ncm = &msg->cm;
/*
+ * Trace Messages
+ */
+ nss_gre_redir_log_tx_msg(msg);
+
+ /*
* Sanity check the message
*/
diff --git a/nss_gre_redir_lag_ds.c b/nss_gre_redir_lag_ds.c
index 5bed7ba..f8c5b65 100644
--- a/nss_gre_redir_lag_ds.c
+++ b/nss_gre_redir_lag_ds.c
@@ -16,6 +16,7 @@
#include "nss_tx_rx_common.h"
#include "nss_gre_redir_lag_ds_stats.h"
+#include "nss_gre_redir_lag_ds_log.h"
#define NSS_GRE_REDIR_LAG_DS_TX_TIMEOUT 3000 /* 3 Seconds */
@@ -148,6 +149,11 @@
}
/*
+ * Trace messages.
+ */
+ nss_gre_redir_lag_ds_log_rx_msg(ngrm);
+
+ /*
* Log failures
*/
nss_core_log_msg_failures(nss_ctx, ncm);
@@ -287,6 +293,11 @@
struct nss_cmn_msg *ncm = &msg->cm;
/*
+ * Trace messages.
+ */
+ nss_gre_redir_lag_ds_log_tx_msg(msg);
+
+ /*
* Sanity check the message. Interface should be a dynamic interface
* of type NSS_DYNAMIC_INTERFACE_TYPE_GRE_REDIR_LAG_DS.
*/
diff --git a/nss_gre_redir_lag_ds_log.c b/nss_gre_redir_lag_ds_log.c
new file mode 100644
index 0000000..41908c0
--- /dev/null
+++ b/nss_gre_redir_lag_ds_log.c
@@ -0,0 +1,164 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_gre_redir_lag_ds_log.c
+ * NSS GRE REDIR LAG DS logger file.
+ */
+
+#include "nss_core.h"
+
+/*
+ * nss_gre_redir_lag_ds_log_message_types_str
+ * GRE REDIR LAG DS message strings
+ */
+static int8_t *nss_gre_redir_lag_ds_log_message_types_str[NSS_GRE_REDIR_LAG_DS_MAX_MSG_TYPES] __maybe_unused = {
+ "GRE REDIR LAG DS add station Message",
+ "GRE REDIR LAG DS delete station message",
+ "GRE REDIR LAG DS update station message",
+ "GRE REDIR LAG DS stats sync message",
+};
+
+/*
+ * nss_gre_redir_lag_ds_log_error_response_types_str
+ * Strings for error types for GRE REDIR LAG DS messages
+ */
+static int8_t *nss_gre_redir_lag_ds_log_error_response_types_str[NSS_GRE_REDIR_LAG_ERR_MAX] __maybe_unused = {
+ "GRE REDIR LAG Success",
+ "GRE REDIR LAG Incorrect Interface",
+ "GRE REDIR LAG DS Core Unregister Failed",
+ "GRE REDIR LAG DS STats Index Not Found",
+ "GRE REDIR LAG Dealloc Failed",
+};
+
+/*
+ * nss_gre_redir_lag_ds_log_add_sta_msg()
+ * Log NSS GRE REDIR LAG DS add STA message.
+ */
+static void nss_gre_redir_lag_ds_log_add_sta_msg(struct nss_gre_redir_lag_ds_msg *ngm)
+{
+ struct nss_gre_redir_lag_ds_add_sta_msg *ngasm __maybe_unused = &ngm->msg.add_sta;
+ nss_trace("%p: NSS GRE REDIR LAG DS Add STA Message:\n"
+ "GRE REDIR LAG DS Station MAC Address: %p\n"
+ "GRE REDIR LAG DS Reorder Type: %d\n",
+ ngasm, ngasm->mac, ngasm->reorder_type);
+}
+
+/*
+ * nss_gre_redir_lag_ds_log_del_sta_msg()
+ * Log NSS GRE REDIR LAG DS del STA message.
+ */
+static void nss_gre_redir_lag_ds_log_del_sta_msg(struct nss_gre_redir_lag_ds_msg *ngm)
+{
+ struct nss_gre_redir_lag_ds_delete_sta_msg *ngdsm __maybe_unused = &ngm->msg.del_sta;
+ nss_trace("%p: NSS GRE REDIR LAG DS Del STA Message:\n"
+ "GRE REDIR LAG DS Station MAC Address: %p\n",
+ ngdsm, ngdsm->mac);
+}
+
+/*
+ * nss_gre_redir_lag_ds_log_add_sta_msg()
+ * Log NSS GRE REDIR LAG DS add STA message.
+ */
+static void nss_gre_redir_lag_ds_log_update_sta_msg(struct nss_gre_redir_lag_ds_msg *ngm)
+{
+ struct nss_gre_redir_lag_ds_update_sta_msg *ngusm __maybe_unused = &ngm->msg.update_sta;
+ nss_trace("%p: NSS GRE REDIR LAG DS Update STA Message:\n"
+ "GRE REDIR LAG DS Station MAC Address: %p\n"
+ "GRE REDIR LAG DS Reorder Type: %d\n",
+ ngusm, ngusm->mac, ngusm->reorder_type);
+}
+
+/*
+ * nss_gre_redir_lag_ds_log_verbose()
+ * Log message contents.
+ */
+static void nss_gre_redir_lag_ds_log_verbose(struct nss_gre_redir_lag_ds_msg *ngm)
+{
+ switch (ngm->cm.type) {
+ case NSS_GRE_REDIR_LAG_DS_ADD_STA_MSG:
+ nss_gre_redir_lag_ds_log_add_sta_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_LAG_DS_DEL_STA_MSG:
+ nss_gre_redir_lag_ds_log_del_sta_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_LAG_DS_UPDATE_STA_MSG:
+ nss_gre_redir_lag_ds_log_update_sta_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_LAG_DS_STATS_SYNC_MSG:
+ /*
+ * No log for valid stats message.
+ */
+ break;
+
+ default:
+ nss_warning("%p: Invalid message type\n", ngm);
+ break;
+ }
+}
+
+/*
+ * nss_gre_redir_lag_ds_log_tx_msg()
+ * Log messages transmitted to FW.
+ */
+void nss_gre_redir_lag_ds_log_tx_msg(struct nss_gre_redir_lag_ds_msg *ngm)
+{
+ if (ngm->cm.type >= NSS_GRE_REDIR_LAG_DS_MAX_MSG_TYPES) {
+ nss_warning("%p: Invalid message type\n", ngm);
+ return;
+ }
+
+ nss_info("%p: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_lag_ds_log_message_types_str[ngm->cm.type]);
+ nss_gre_redir_lag_ds_log_verbose(ngm);
+}
+
+/*
+ * nss_gre_redir_lag_ds_log_rx_msg()
+ * Log messages received from FW.
+ */
+void nss_gre_redir_lag_ds_log_rx_msg(struct nss_gre_redir_lag_ds_msg *ngm)
+{
+ if (ngm->cm.response >= NSS_CMN_RESPONSE_LAST) {
+ nss_warning("%p: Invalid response\n", ngm);
+ return;
+ }
+
+ if (ngm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ngm->cm.response == NSS_CMN_RESPONSE_ACK)) {
+ nss_info("%p: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type,
+ nss_gre_redir_lag_ds_log_message_types_str[ngm->cm.type],
+ ngm->cm.response, nss_cmn_response_str[ngm->cm.response]);
+ goto verbose;
+ }
+
+ if (ngm->cm.error >= NSS_GRE_REDIR_LAG_ERR_MAX) {
+ nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n",
+ ngm, ngm->cm.type, nss_gre_redir_lag_ds_log_message_types_str[ngm->cm.type],
+ ngm->cm.response, nss_cmn_response_str[ngm->cm.response],
+ ngm->cm.error);
+ goto verbose;
+ }
+
+ nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n",
+ ngm, ngm->cm.type, nss_gre_redir_lag_ds_log_message_types_str[ngm->cm.type],
+ ngm->cm.response, nss_cmn_response_str[ngm->cm.response],
+ ngm->cm.error, nss_gre_redir_lag_ds_log_error_response_types_str[ngm->cm.error]);
+
+verbose:
+ nss_gre_redir_lag_ds_log_verbose(ngm);
+}
diff --git a/nss_gre_redir_lag_ds_log.h b/nss_gre_redir_lag_ds_log.h
new file mode 100644
index 0000000..b091876
--- /dev/null
+++ b/nss_gre_redir_lag_ds_log.h
@@ -0,0 +1,37 @@
+/*
+ ******************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * ****************************************************************************
+ */
+
+#ifndef __NSS_GRE_REDIR_LAG_DS_LOG_H__
+#define __NSS_GRE_REDIR_LAG_DS_LOG_H__
+
+/*
+ * nss_gre_redir_lag_ds_log.h
+ * NSS GRE REDIR LAG DS Log Header File
+ */
+
+/*
+ * nss_gre_redir_lag_ds_log_tx_msg
+ * Logs a gre redir lag ds message that is sent to the NSS firmware.
+ */
+void nss_gre_redir_lag_ds_log_tx_msg(struct nss_gre_redir_lag_ds_msg *ngm);
+
+/*
+ * nss_gre_redir_lag_ds_log_rx_msg
+ * Logs a gre redir lag ds message that is received from the NSS firmware.
+ */
+void nss_gre_redir_lag_ds_log_rx_msg(struct nss_gre_redir_lag_ds_msg *ngm);
+
+#endif /* __NSS_GRE_REDIR_LAG_DS_LOG_H__ */
diff --git a/nss_gre_redir_lag_us.c b/nss_gre_redir_lag_us.c
index 18690a4..67fa13d 100644
--- a/nss_gre_redir_lag_us.c
+++ b/nss_gre_redir_lag_us.c
@@ -16,6 +16,7 @@
#include "nss_tx_rx_common.h"
#include "nss_gre_redir_lag_us_stats.h"
+#include "nss_gre_redir_lag_us_log.h"
#define NSS_GRE_REDIR_LAG_US_TX_TIMEOUT 3000 /* 3 Seconds */
#define NSS_GRE_REDIR_LAG_US_STATS_SYNC_PERIOD msecs_to_jiffies(4000)
@@ -200,6 +201,11 @@
BUG_ON(!nss_gre_redir_lag_us_verify_ifnum(ncm->interface));
/*
+ * Trace messages.
+ */
+ nss_gre_redir_lag_us_log_rx_msg(ngrm);
+
+ /*
* Is this a valid request/response packet?
*/
if (ncm->type >= NSS_GRE_REDIR_LAG_US_MAX_MSG_TYPES) {
@@ -609,6 +615,11 @@
*/
nss_tx_status_t nss_gre_redir_lag_us_tx_msg(struct nss_ctx_instance *nss_ctx, struct nss_gre_redir_lag_us_msg *ngrm)
{
+ /*
+ * Trace messages.
+ */
+ nss_gre_redir_lag_us_log_tx_msg(ngrm);
+
return nss_gre_redir_lag_us_tx_msg_with_size(nss_ctx, ngrm, NSS_NBUF_PAYLOAD_SIZE);
}
EXPORT_SYMBOL(nss_gre_redir_lag_us_tx_msg);
diff --git a/nss_gre_redir_lag_us_log.c b/nss_gre_redir_lag_us_log.c
new file mode 100644
index 0000000..aeca74d
--- /dev/null
+++ b/nss_gre_redir_lag_us_log.c
@@ -0,0 +1,191 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_gre_redir_lag_us_log.c
+ * NSS GRE REDIR LAG US logger file.
+ */
+
+#include "nss_core.h"
+
+/*
+ * nss_gre_redir_lag_us_log_message_types_str
+ * GRE REDIR LAG US message strings
+ */
+static int8_t *nss_gre_redir_lag_us_log_message_types_str[NSS_GRE_REDIR_LAG_US_MAX_MSG_TYPES] __maybe_unused = {
+ "GRE REDIR LAG US config Message",
+ "GRE REDIR LAG US add hash node message",
+ "GRE REDIR LAG US delete hash node message",
+ "GRE REDIR LAG US query hash node message",
+ "GRE REDIR LAG US stats sync message",
+ "GRE REDIR LAG US DB hash node message",
+};
+
+/*
+ * nss_gre_redir_lag_us_log_error_response_types_str
+ * Strings for error types for GRE REDIR LAG US messages
+ */
+static int8_t *nss_gre_redir_lag_us_log_error_response_types_str[NSS_GRE_REDIR_LAG_ERR_MAX] __maybe_unused = {
+ "GRE REDIR LAG Success",
+ "GRE REDIR LAG Incorrect Interface",
+ "GRE REDIR LAG US Core Unregister Failed",
+ "GRE REDIR LAG US STats Index Not Found",
+ "GRE REDIR LAG Dealloc Failed",
+};
+
+/*
+ * nss_gre_redir_lag_us_log_config_msg()
+ * Log NSS GRE REDIR LAG US config message.
+ */
+static void nss_gre_redir_lag_us_log_config_msg(struct nss_gre_redir_lag_us_msg *ngm)
+{
+ struct nss_gre_redir_lag_us_config_msg *ngcm __maybe_unused = &ngm->msg.config_us;
+ nss_trace("%p: NSS GRE REDIR LAG Config Message:\n"
+ "GRE REDIR LAG US Hash Mode: %d\n"
+ "GRE REDIR LAG US Number of Slaves: %d\n"
+ "GRE REDIR LAG US Interface Number: %p\n",
+ ngcm, ngcm->hash_mode, ngcm->num_slaves,
+ ngcm->if_num);
+}
+
+/*
+ * nss_gre_redir_lag_us_log_add_hash_node_msg()
+ * Log NSS GRE REDIR LAG US add hash node message.
+ */
+static void nss_gre_redir_lag_us_log_add_hash_node_msg(struct nss_gre_redir_lag_us_msg *ngm)
+{
+ struct nss_gre_redir_lag_us_add_hash_node_msg *ngam __maybe_unused = &ngm->msg.add_hash;
+ nss_trace("%p: NSS GRE REDIR LAG Add Hash Node Message:\n"
+ "GRE REDIR LAG US Interface Number: %d\n"
+ "GRE REDIR LAG US Source MAC: %p\n"
+ "GRE REDIR LAG US Destination MAC: %p\n",
+ ngam, ngam->if_num, ngam->src_mac,
+ ngam->dest_mac);
+}
+
+/*
+ * nss_gre_redir_lag_us_log_del_hash_node_msg()
+ * Log NSS GRE REDIR LAG US del hash node message.
+ */
+static void nss_gre_redir_lag_us_log_del_hash_node_msg(struct nss_gre_redir_lag_us_msg *ngm)
+{
+ struct nss_gre_redir_lag_us_del_hash_node_msg *ngdm __maybe_unused = &ngm->msg.del_hash;
+ nss_trace("%p: NSS GRE REDIR LAG Del Hash Node Message:\n"
+ "GRE REDIR LAG US Source MAC: %p\n"
+ "GRE REDIR LAG US Destination MAC: %p\n",
+ ngdm, ngdm->src_mac,ngdm->dest_mac);
+}
+
+/*
+ * nss_gre_redir_lag_us_log_query_hash_node_msg()
+ * Log NSS GRE REDIR LAG US query hash node message.
+ */
+static void nss_gre_redir_lag_us_log_query_hash_node_msg(struct nss_gre_redir_lag_us_msg *ngm)
+{
+ struct nss_gre_redir_lag_us_query_hash_node_msg *ngqm __maybe_unused = &ngm->msg.query_hash;
+ nss_trace("%p: NSS GRE REDIR LAG Query Hash Node Message:\n"
+ "GRE REDIR LAG US Source MAC: %p\n"
+ "GRE REDIR LAG US Destination MAC: %p\n"
+ "GRE REDIR LAG US Interface Number: %d\n",
+ ngqm, ngqm->src_mac, ngqm->dest_mac,
+ ngqm->ifnum);
+}
+
+/*
+ * nss_gre_redir_lag_us_log_verbose()
+ * Log message contents.
+ */
+static void nss_gre_redir_lag_us_log_verbose(struct nss_gre_redir_lag_us_msg *ngm)
+{
+ switch (ngm->cm.type) {
+ case NSS_GRE_REDIR_LAG_US_CONFIG_MSG:
+ nss_gre_redir_lag_us_log_config_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_LAG_US_ADD_HASH_NODE_MSG:
+ nss_gre_redir_lag_us_log_add_hash_node_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_LAG_US_DEL_HASH_NODE_MSG:
+ nss_gre_redir_lag_us_log_del_hash_node_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_LAG_US_QUERY_HASH_NODE_MSG:
+ nss_gre_redir_lag_us_log_query_hash_node_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_LAG_US_CMN_STATS_SYNC_MSG:
+ case NSS_GRE_REDIR_LAG_US_DB_HASH_NODE_MSG:
+ /*
+ * No log for valid stats message.
+ */
+ break;
+
+ default:
+ nss_warning("%p: Invalid message type\n", ngm);
+ break;
+ }
+}
+
+/*
+ * nss_gre_redir_lag_us_log_tx_msg()
+ * Log messages transmitted to FW.
+ */
+void nss_gre_redir_lag_us_log_tx_msg(struct nss_gre_redir_lag_us_msg *ngm)
+{
+ if (ngm->cm.type >= NSS_GRE_REDIR_LAG_US_MAX_MSG_TYPES) {
+ nss_warning("%p: Invalid message type\n", ngm);
+ return;
+ }
+
+ nss_info("%p: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_lag_us_log_message_types_str[ngm->cm.type]);
+ nss_gre_redir_lag_us_log_verbose(ngm);
+}
+
+/*
+ * nss_gre_redir_lag_us_log_rx_msg()
+ * Log messages received from FW.
+ */
+void nss_gre_redir_lag_us_log_rx_msg(struct nss_gre_redir_lag_us_msg *ngm)
+{
+ if (ngm->cm.response >= NSS_CMN_RESPONSE_LAST) {
+ nss_warning("%p: Invalid response\n", ngm);
+ return;
+ }
+
+ if (ngm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ngm->cm.response == NSS_CMN_RESPONSE_ACK)) {
+ nss_info("%p: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type,
+ nss_gre_redir_lag_us_log_message_types_str[ngm->cm.type],
+ ngm->cm.response, nss_cmn_response_str[ngm->cm.response]);
+ goto verbose;
+ }
+
+ if (ngm->cm.error >= NSS_GRE_REDIR_LAG_ERR_MAX) {
+ nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n",
+ ngm, ngm->cm.type, nss_gre_redir_lag_us_log_message_types_str[ngm->cm.type],
+ ngm->cm.response, nss_cmn_response_str[ngm->cm.response],
+ ngm->cm.error);
+ goto verbose;
+ }
+
+ nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n",
+ ngm, ngm->cm.type, nss_gre_redir_lag_us_log_message_types_str[ngm->cm.type],
+ ngm->cm.response, nss_cmn_response_str[ngm->cm.response],
+ ngm->cm.error, nss_gre_redir_lag_us_log_error_response_types_str[ngm->cm.error]);
+
+verbose:
+ nss_gre_redir_lag_us_log_verbose(ngm);
+}
diff --git a/nss_gre_redir_lag_us_log.h b/nss_gre_redir_lag_us_log.h
new file mode 100644
index 0000000..cbda8d9
--- /dev/null
+++ b/nss_gre_redir_lag_us_log.h
@@ -0,0 +1,37 @@
+/*
+ ******************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * ****************************************************************************
+ */
+
+#ifndef __NSS_GRE_REDIR_LAG_US_LOG_H__
+#define __NSS_GRE_REDIR_LAG_US_LOG_H__
+
+/*
+ * nss_gre_redir_lag_us_log.h
+ * NSS GRE REDIR LAG US Log Header File
+ */
+
+/*
+ * nss_gre_redir_lag_us_log_tx_msg
+ * Logs a gre redir lag us message that is sent to the NSS firmware.
+ */
+void nss_gre_redir_lag_us_log_tx_msg(struct nss_gre_redir_lag_us_msg *ngm);
+
+/*
+ * nss_gre_redir_lag_us_log_rx_msg
+ * Logs a gre redir lag us message that is received from the NSS firmware.
+ */
+void nss_gre_redir_lag_us_log_rx_msg(struct nss_gre_redir_lag_us_msg *ngm);
+
+#endif /* __NSS_GRE_REDIR_LAG_US_LOG_H__ */
diff --git a/nss_gre_redir_log.c b/nss_gre_redir_log.c
new file mode 100644
index 0000000..00fb68a
--- /dev/null
+++ b/nss_gre_redir_log.c
@@ -0,0 +1,225 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_gre_redir_log.c
+ * NSS GRE REDIR logger file.
+ */
+
+#include "nss_core.h"
+
+/*
+ * nss_gre_redir_log_message_types_str
+ * NSS GRE REDIR message strings
+ */
+static int8_t *nss_gre_redir_log_message_types_str[NSS_GRE_REDIR_MAX_MSG_TYPES] __maybe_unused = {
+ "GRE REDIR Tunnel Inner Configure",
+ "GRE REDIR Tunnel Outer Configure",
+ "GRE REDIR Interface Map",
+ "GRE REDIR Interface Unmap",
+ "GRE REDIR SJACK Map",
+ "GRE REDIR SJACK Unmap",
+ "GRE REDIR Stats Sync"
+};
+
+/*
+ * nss_gre_redir_log_inner_configure_msg()
+ * Log NSS GRE Redir inner configure message.
+ */
+static void nss_gre_redir_log_inner_configure_msg(struct nss_gre_redir_msg *ngm)
+{
+ struct nss_gre_redir_inner_configure_msg *ngicm __maybe_unused = &ngm->msg.inner_configure;
+ nss_trace("%p: NSS GRE Redir Inner Configure message"
+ "GRE REDIR IP Header Type: %d\n"
+ "GRE REDIR Source IP: %p\n"
+ "GRE REDIR Destination IP: %p\n"
+ "GRE REDIR Outer Interface: %d\n"
+ "GRE REDIR Do not Fragment: %d\n"
+ "GRE REDIR IP TTL: %d\n"
+ "GRE REDIR Version: %d\n",
+ ngicm, ngicm->ip_hdr_type,
+ ngicm->ip_src_addr, ngicm->ip_dest_addr,
+ ngicm->except_outerif, ngicm->ip_df_policy,
+ ngicm->ip_ttl, ngicm->gre_version);
+}
+
+/*
+ * nss_gre_redir_log_interface_map_msg()
+ * Log NSS GRE Redir interface map message.
+ */
+static void nss_gre_redir_log_interface_map_msg(struct nss_gre_redir_msg *ngm)
+{
+ struct nss_gre_redir_interface_map_msg *ngicm __maybe_unused = &ngm->msg.interface_map;
+ nss_trace("%p: NSS GRE Redir Interface Map message"
+ "GRE REDIR NSS VAP Interface: %d\n"
+ "GRE REDIR Next Hop NSS Interface: %d\n"
+ "GRE REDIR Radio ID: %d\n"
+ "GRE REDIR VAP ID: %d\n"
+ "GRE REDIR LAG Flags: %x\n"
+ "GRE REDIR Tunnel Type: %d\n",
+ ngicm, ngicm->vap_nssif,
+ ngicm->nexthop_nssif, ngicm->radio_id,
+ ngicm->vap_id, ngicm->lag_en,
+ ngicm->tunnel_type);
+}
+
+/*
+ * nss_gre_redir_log_interface_unmap_msg()
+ * Log NSS GRE Redir interface unmap message.
+ */
+static void nss_gre_redir_log_interface_unmap_msg(struct nss_gre_redir_msg *ngm)
+{
+ struct nss_gre_redir_interface_unmap_msg *ngicm __maybe_unused = &ngm->msg.interface_unmap;
+ nss_trace("%p: NSS GRE Redir Interface Map message"
+ "GRE REDIR NSS VAP Interface: %d\n"
+ "GRE REDIR Radio ID: %d\n"
+ "GRE REDIR VAP ID: %d\n",
+ ngicm, ngicm->vap_nssif,
+ ngicm->radio_id, ngicm->vap_id);
+}
+
+/*
+ * nss_gre_redir_log_sjack_map_msg()
+ * Log NSS GRE Redir interface map message.
+ */
+static void nss_gre_redir_log_sjack_map_msg(struct nss_gre_redir_msg *ngm)
+{
+ struct nss_gre_redir_sjack_map_msg *ngscm __maybe_unused = &ngm->msg.sjack_map;
+ nss_trace("%p: NSS GRE Redir SJACK Map message"
+ "GRE REDIR Eth NSS Interface: %d\n"
+ "GRE REDIR Eth Interface ID: %d\n"
+ "GRE REDIR IPSec pattern: %x\n",
+ ngscm, ngscm->eth_nssif,
+ ngscm->eth_id, ngscm->use_ipsec_sa_pattern);
+}
+
+/*
+ * nss_gre_redir_log_sjack_unmap_msg()
+ * Log NSS GRE Redir interface unmap message.
+ */
+static void nss_gre_redir_log_sjack_unmap_msg(struct nss_gre_redir_msg *ngm)
+{
+ struct nss_gre_redir_sjack_unmap_msg *ngscm __maybe_unused = &ngm->msg.sjack_unmap;
+ nss_trace("%p: NSS GRE Redir SJACK Map message"
+ "GRE REDIR Eth NSS Interface: %d\n"
+ "GRE REDIR Eth Interface ID: %d\n",
+ ngscm, ngscm->eth_nssif,
+ ngscm->eth_id);
+}
+
+/*
+ * nss_gre_redir_log_outer_configure_msg()
+ * Log NSS GRE Redir outer configure message.
+ */
+static void nss_gre_redir_log_outer_configure_msg(struct nss_gre_redir_msg *ngm)
+{
+ struct nss_gre_redir_outer_configure_msg *ngocm __maybe_unused = &ngm->msg.outer_configure;
+ nss_trace("%p: NSS GRE Redir Outer Configure message"
+ "GRE REDIR IP Header Type: %d\n"
+ "GRE REDIR Host Inner Interface: %d\n"
+ "GRE REDIR NSS Inner Interface: %d\n"
+ "GRE REDIR SJACK Inner Interface: %d\n"
+ "GRE REDIR RPS: %d\n"
+ "GRE REDIR RPS Valid: %d\n",
+ ngocm, ngocm->ip_hdr_type,
+ ngocm->except_hostif, ngocm->except_offlif,
+ ngocm->except_sjackif, ngocm->rps_hint,
+ ngocm->rps_hint_valid);
+}
+
+/*
+ * nss_gre_redir_log_verbose()
+ * Log message contents.
+ */
+static void nss_gre_redir_log_verbose(struct nss_gre_redir_msg *ngm)
+{
+ switch (ngm->cm.type) {
+ case NSS_GRE_REDIR_TX_TUNNEL_INNER_CONFIGURE_MSG:
+ nss_gre_redir_log_inner_configure_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_TX_TUNNEL_OUTER_CONFIGURE_MSG:
+ nss_gre_redir_log_outer_configure_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_TX_INTERFACE_MAP_MSG:
+ nss_gre_redir_log_interface_map_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_TX_INTERFACE_UNMAP_MSG:
+ nss_gre_redir_log_interface_unmap_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_TX_SJACK_MAP_MSG:
+ nss_gre_redir_log_sjack_map_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_TX_SJACK_UNMAP_MSG:
+ nss_gre_redir_log_sjack_unmap_msg(ngm);
+ break;
+
+ case NSS_GRE_REDIR_RX_STATS_SYNC_MSG:
+ /*
+ * No log for valid stats message.
+ */
+ break;
+
+ default:
+ nss_warning("%p: Invalid message type\n", ngm);
+ break;
+ }
+}
+
+/*
+ * nss_gre_redir_log_tx_msg()
+ * Log messages transmitted to FW.
+ */
+void nss_gre_redir_log_tx_msg(struct nss_gre_redir_msg *ngm)
+{
+ if (ngm->cm.type >= NSS_GRE_REDIR_MAX_MSG_TYPES) {
+ nss_warning("%p: Invalid message type\n", ngm);
+ return;
+ }
+
+ nss_info("%p: type[%d]:%s\n", ngm, ngm->cm.type, nss_gre_redir_log_message_types_str[ngm->cm.type]);
+ nss_gre_redir_log_verbose(ngm);
+}
+
+/*
+ * nss_gre_redir_log_rx_msg()
+ * Log messages received from FW.
+ */
+void nss_gre_redir_log_rx_msg(struct nss_gre_redir_msg *ngm)
+{
+ if (ngm->cm.response >= NSS_CMN_RESPONSE_LAST) {
+ nss_warning("%p: Invalid response\n", ngm);
+ return;
+ }
+
+ if (ngm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ngm->cm.response == NSS_CMN_RESPONSE_ACK)) {
+ nss_info("%p: type[%d]:%s, response[%d]:%s\n", ngm, ngm->cm.type,
+ nss_gre_redir_log_message_types_str[ngm->cm.type],
+ ngm->cm.response, nss_cmn_response_str[ngm->cm.response]);
+ goto verbose;
+ }
+
+ nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n",
+ ngm, ngm->cm.type, nss_gre_redir_log_message_types_str[ngm->cm.type],
+ ngm->cm.response, nss_cmn_response_str[ngm->cm.response]);
+
+verbose:
+ nss_gre_redir_log_verbose(ngm);
+}
diff --git a/nss_gre_redir_log.h b/nss_gre_redir_log.h
new file mode 100644
index 0000000..7e1fb79
--- /dev/null
+++ b/nss_gre_redir_log.h
@@ -0,0 +1,41 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+#ifndef __NSS_GRE_REDIR_LOG_H
+#define __NSS_GRE_REDIR_LOG_H
+
+/*
+ * nss_gre_redir_log.h
+ * NSS GRE REDIR Log header file.
+ */
+
+/*
+ * Logger APIs
+ */
+
+/*
+ * nss_gre_redir_log_tx_msg
+ * Logs a gre_redir message that is sent to the NSS firmware.
+ */
+void nss_gre_redir_log_tx_msg(struct nss_gre_redir_msg *ngm);
+
+/*
+ * nss_gre_redir_log_rx_msg
+ * Logs a gre_redir message that is received from the NSS firmware.
+ */
+void nss_gre_redir_log_rx_msg(struct nss_gre_redir_msg *ngm);
+
+#endif /* __NSS_GRE_REDIR_LOG_H */
diff --git a/nss_gre_stats.c b/nss_gre_stats.c
index 7bead7b..e5226be 100644
--- a/nss_gre_stats.c
+++ b/nss_gre_stats.c
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -124,6 +124,7 @@
void nss_gre_stats_session_debug_sync(struct nss_ctx_instance *nss_ctx, struct nss_gre_session_stats_msg *sstats, uint16_t if_num)
{
int i, j;
+ enum nss_dynamic_interface_type interface_type = nss_dynamic_interface_get_type(nss_ctx, if_num);
spin_lock_bh(&nss_gre_stats_lock);
for (i = 0; i < NSS_GRE_MAX_DEBUG_SESSION_STATS; i++) {
@@ -131,6 +132,12 @@
for (j = 0; j < NSS_GRE_STATS_SESSION_DEBUG_MAX; j++) {
session_debug_stats[i].stats[j] += sstats->stats[j];
}
+
+ if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_INNER) {
+ session_debug_stats[i].stats[NSS_GRE_STATS_SESSION_ENCAP_RX_RECEIVED] += sstats->node_stats.rx_packets;
+ } else if (interface_type == NSS_DYNAMIC_INTERFACE_TYPE_GRE_OUTER) {
+ session_debug_stats[i].stats[NSS_GRE_STATS_SESSION_DECAP_TX_FORWARDED] += sstats->node_stats.tx_packets;
+ }
break;
}
}
diff --git a/nss_hlos_if.h b/nss_hlos_if.h
index f99f147..19b367d 100644
--- a/nss_hlos_if.h
+++ b/nss_hlos_if.h
@@ -348,6 +348,6 @@
/* Index number for the next descriptor that will be written by the HLOS in the H2N0 descriptor ring (HLOS owned) */
volatile uint32_t n2h_hlos_index[15];
/* Index number for the next descriptor that will be read by the HLOS in the N2H0 descriptor ring (HLOS owned) */
- uint32_t c2c_start; /* Reserved for future use */
+ uint32_t reserved; /* Reserved for future use */
};
#endif /* __NSS_HLOS_IF_H */
diff --git a/nss_l2tpv2.c b/nss_l2tpv2.c
index b874b01..f2c012b 100644
--- a/nss_l2tpv2.c
+++ b/nss_l2tpv2.c
@@ -18,6 +18,7 @@
#include <net/sock.h>
#include "nss_tx_rx_common.h"
#include "nss_l2tpv2_stats.h"
+#include "nss_l2tpv2_log.h"
/*
* Data structures to store l2tpv2 nss debug stats
@@ -84,6 +85,11 @@
BUG_ON(!(nss_is_dynamic_interface(ncm->interface) || ncm->interface == NSS_L2TPV2_INTERFACE));
/*
+ * Trace Messages
+ */
+ nss_l2tpv2_log_rx_msg(ntm);
+
+ /*
* Is this a valid request/response packet?
*/
if (ncm->type >= NSS_L2TPV2_MSG_MAX) {
@@ -152,6 +158,11 @@
struct nss_cmn_msg *ncm = &msg->cm;
/*
+ * Trace Messages
+ */
+ nss_l2tpv2_log_tx_msg(msg);
+
+ /*
* Sanity check the message
*/
if (!nss_is_dynamic_interface(ncm->interface)) {
diff --git a/nss_l2tpv2_log.c b/nss_l2tpv2_log.c
new file mode 100644
index 0000000..4b60c71
--- /dev/null
+++ b/nss_l2tpv2_log.c
@@ -0,0 +1,143 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_l2tpv2_log.c
+ * NSS L2TPV2 logger file.
+ */
+
+#include "nss_core.h"
+
+/*
+ * nss_l2tpv2_log_message_types_str
+ * NSS L2TPV2 message strings
+ */
+static int8_t *nss_l2tpv2_log_message_types_str[NSS_L2TPV2_MSG_MAX] __maybe_unused = {
+ "L2TPV2 Sesstion Create",
+ "L2TPV2 Session Destroy",
+ "L2TPV2 Stats",
+};
+
+/*
+ * nss_l2tpv2_log_session_create_msg()
+ * Log NSS L2TPV2 Session Create.
+ */
+static void nss_l2tpv2_log_session_create_msg(struct nss_l2tpv2_msg *nlm)
+{
+ struct nss_l2tpv2_session_create_msg *nlcm __maybe_unused = &nlm->msg.session_create_msg;
+ nss_trace("%p: NSS L2TPV2 Session Create message \n"
+ "L2TPV2 Local Tunnel ID: %x\n"
+ "L2TPV2 Local Session ID: %x\n"
+ "L2TPV2 Peer Tunnel ID: %x\n"
+ "L2TPV2 Peer Session ID: %x\n"
+ "L2TPV2 Source IP: %x\n"
+ "L2TPV2 Destnation IP: %x\n"
+ "L2TPV2 Reorder Timeout: %d\n"
+ "L2TPV2 Source Port: %d\n"
+ "L2TPV2 Destination Port: %d\n"
+ "L2TPV2 Received Sequence Number: %d\n"
+ "L2TPV2 Outer IP Packet TTL: %d\n"
+ "L2TPV2 UDP Checksum: %d\n",
+ nlcm, nlcm->local_tunnel_id,
+ nlcm->local_session_id, nlcm->peer_tunnel_id,
+ nlcm->peer_session_id, nlcm->sip,
+ nlcm->dip, nlcm->reorder_timeout,
+ nlcm->sport, nlcm->dport,
+ nlcm->recv_seq, nlcm->oip_ttl,
+ nlcm->udp_csum);
+}
+
+/*
+ * nss_l2tpv2_log_session_destroy_msg()
+ * Log NSS L2TPV2 Session Create.
+ */
+static void nss_l2tpv2_log_session_destroy_msg(struct nss_l2tpv2_msg *nlm)
+{
+ struct nss_l2tpv2_session_destroy_msg *nldm __maybe_unused = &nlm->msg.session_destroy_msg;
+ nss_trace("%p: NSS L2TPV2 Session Destroy message \n"
+ "L2TPV2 Local Tunnel ID: %x\n"
+ "L2TPV2 Local Session ID: %x\n",
+ nldm, nldm->local_tunnel_id,
+ nldm->local_session_id);
+}
+
+/*
+ * nss_l2tpv2_log_verbose()
+ * Log message contents.
+ */
+static void nss_l2tpv2_log_verbose(struct nss_l2tpv2_msg *nlm)
+{
+ switch (nlm->cm.type) {
+ case NSS_L2TPV2_MSG_SESSION_CREATE:
+ nss_l2tpv2_log_session_create_msg(nlm);
+ break;
+
+ case NSS_L2TPV2_MSG_SESSION_DESTROY:
+ nss_l2tpv2_log_session_destroy_msg(nlm);
+ break;
+
+ case NSS_L2TPV2_MSG_SYNC_STATS:
+ /*
+ * No log for valid stats message.
+ */
+ break;
+
+ default:
+ nss_trace("%p: Invalid message type\n", nlm);
+ break;
+ }
+}
+
+/*
+ * nss_l2tpv2_log_tx_msg()
+ * Log messages transmitted to FW.
+ */
+void nss_l2tpv2_log_tx_msg(struct nss_l2tpv2_msg *nlm)
+{
+ if (nlm->cm.type >= NSS_L2TPV2_MSG_MAX) {
+ nss_warning("%p: Invalid message type\n", nlm);
+ return;
+ }
+
+ nss_info("%p: type[%d]:%s\n", nlm, nlm->cm.type, nss_l2tpv2_log_message_types_str[nlm->cm.type]);
+ nss_l2tpv2_log_verbose(nlm);
+}
+
+/*
+ * nss_l2tpv2_log_rx_msg()
+ * Log messages received from FW.
+ */
+void nss_l2tpv2_log_rx_msg(struct nss_l2tpv2_msg *nlm)
+{
+ if (nlm->cm.response >= NSS_CMN_RESPONSE_LAST) {
+ nss_warning("%p: Invalid response\n", nlm);
+ return;
+ }
+
+ if (nlm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nlm->cm.response == NSS_CMN_RESPONSE_ACK)) {
+ nss_info("%p: type[%d]:%s, response[%d]:%s\n", nlm, nlm->cm.type,
+ nss_l2tpv2_log_message_types_str[nlm->cm.type],
+ nlm->cm.response, nss_cmn_response_str[nlm->cm.response]);
+ goto verbose;
+ }
+
+ nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n",
+ nlm, nlm->cm.type, nss_l2tpv2_log_message_types_str[nlm->cm.type],
+ nlm->cm.response, nss_cmn_response_str[nlm->cm.response]);
+
+verbose:
+ nss_l2tpv2_log_verbose(nlm);
+}
diff --git a/nss_l2tpv2_log.h b/nss_l2tpv2_log.h
new file mode 100644
index 0000000..56cc9de
--- /dev/null
+++ b/nss_l2tpv2_log.h
@@ -0,0 +1,41 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+#ifndef __NSS_L2TPV2_LOG_H
+#define __NSS_L2TPV2_LOG_H
+
+/*
+ * nss_l2tpv2.h
+ * NSS L2TPV2 header file.
+ */
+
+/*
+ * Logger APIs
+ */
+
+/*
+ * nss_l2tpv2_log_tx_msg
+ * Logs a l2tpv2 message that is sent to the NSS firmware.
+ */
+void nss_l2tpv2_log_tx_msg(struct nss_l2tpv2_msg *ntm);
+
+/*
+ * nss_l2tpv2_log_rx_msg
+ * Logs a l2tpv2 message that is received from the NSS firmware.
+ */
+void nss_l2tpv2_log_rx_msg(struct nss_l2tpv2_msg *ntm);
+
+#endif /* __NSS_L2TPV2_LOG_H */
diff --git a/nss_map_t.c b/nss_map_t.c
index 30ecf2a..d165ed3 100644
--- a/nss_map_t.c
+++ b/nss_map_t.c
@@ -16,6 +16,7 @@
#include "nss_tx_rx_common.h"
#include "nss_map_t_stats.h"
+#include "nss_map_t_log.h"
#define NSS_MAP_T_TX_TIMEOUT 3000 /* 3 Seconds */
@@ -123,6 +124,11 @@
BUG_ON(!nss_map_t_verify_if_num(ncm->interface));
/*
+ * Trace Messages
+ */
+ nss_map_t_log_rx_msg(ntm);
+
+ /*
* Is this a valid request/response packet?
*/
if (ncm->type >= NSS_MAP_T_MSG_MAX) {
@@ -211,6 +217,11 @@
struct nss_cmn_msg *ncm = &msg->cm;
/*
+ * Trace Messages
+ */
+ nss_map_t_log_tx_msg(msg);
+
+ /*
* Sanity check the message
*/
if (!nss_is_dynamic_interface(ncm->interface)) {
diff --git a/nss_map_t_log.c b/nss_map_t_log.c
new file mode 100644
index 0000000..27ea92d
--- /dev/null
+++ b/nss_map_t_log.c
@@ -0,0 +1,151 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_map_t_log.c
+ * NSS MAP_T logger file.
+ */
+
+#include "nss_core.h"
+
+/*
+ * nss_map_t_log_message_types_str
+ * NSS MAP_T message strings
+ */
+static int8_t *nss_map_t_log_message_types_str[NSS_MAP_T_MSG_MAX] __maybe_unused = {
+ "MAP_T Rule Configure",
+ "MAP_T Rule Deconfigure",
+ "MAP_T Stats",
+};
+
+/*
+ * nss_map_t_log_rule_configure_msg()
+ * Log NSS MAP_T Rule Configure.
+ */
+static void nss_map_t_log_rule_configure_msg(struct nss_map_t_msg *ntm)
+{
+ struct nss_map_t_instance_rule_config_msg *ntcm __maybe_unused = &ntm->msg.create_msg;
+ nss_trace("%p: NSS MAP_T Rule Configure message \n"
+ "MAP_T Rule Seq Number: %d\n"
+ "MAP_T Total Number of Rules: %d\n"
+ "MAP_T Local IPv6 Prefix Length: %d\n"
+ "MAP_T Local IPv4 Prefix: %d\n"
+ "MAP_T Local IPv4 Prefix Length: %d\n"
+ "MAP_T Local EA Bits Length: %d\n"
+ "MAP_T Local PSID Offset: %d\n"
+ "MAP_T Reserved A: %d\n"
+ "MAP_T Remote IPv6 Prefix Length: %d\n"
+ "MAP_T Remote IPv4 Prefix: %d\n"
+ "MAP_T Remote IPv4 Prefix Length: %d\n"
+ "MAP_T Remote EA Bits Length: %d\n"
+ "MAP_T Remote PSID Offset: %d\n"
+ "MAP_T Local MAP Style: %d\n"
+ "MAP_T Remote Map Style: %d\n"
+ "MAP_T Local IPv6 Prefix: %p\n"
+ "MAP_T Reserved B: %p\n"
+ "MAP_T Remote IPv6 Prefix: %p\n"
+ "MAP_T Valid Rule: %d\n",
+ ntcm, ntcm->rule_num, ntcm->total_rules,
+ ntcm->local_ipv6_prefix_len, ntcm->local_ipv4_prefix,
+ ntcm->local_ipv4_prefix_len, ntcm->local_ea_len,
+ ntcm->local_psid_offset, ntcm->reserve_a,
+ ntcm->remote_ipv6_prefix_len,
+ ntcm->remote_ipv4_prefix, ntcm->remote_ipv4_prefix_len,
+ ntcm->remote_ea_len, ntcm->remote_psid_offset,
+ ntcm->local_map_style, ntcm->remote_map_style,
+ ntcm->local_ipv6_prefix, ntcm->reserve_b,
+ ntcm->remote_ipv6_prefix, ntcm->valid_rule);
+}
+
+/*
+ * nss_map_t_log_rule_deconfig_msg()
+ * Log NSS MAP_T Rule Deconfigure.
+ */
+static void nss_map_t_log_rule_deconfig_msg(struct nss_map_t_msg *ntm)
+{
+ struct nss_map_t_instance_rule_deconfig_msg *ntdm __maybe_unused = &ntm->msg.destroy_msg;
+ nss_trace("%p: NSS MAP_T Rule Deconfigure message \n"
+ "MAP_T Interface Number: %d\n",
+ ntdm, ntdm->if_number);
+}
+
+/*
+ * nss_map_t_log_verbose()
+ * Log message contents.
+ */
+static void nss_map_t_log_verbose(struct nss_map_t_msg *ntm)
+{
+ switch (ntm->cm.type) {
+ case NSS_MAP_T_MSG_INSTANCE_RULE_CONFIGURE:
+ nss_map_t_log_rule_configure_msg(ntm);
+ break;
+
+ case NSS_MAP_T_MSG_INSTANCE_RULE_DECONFIGURE:
+ nss_map_t_log_rule_deconfig_msg(ntm);
+ break;
+
+ case NSS_MAP_T_MSG_SYNC_STATS:
+ /*
+ * No log for valid stats message.
+ */
+ break;
+
+ default:
+ nss_trace("%p: Invalid message type\n", ntm);
+ break;
+ }
+}
+
+/*
+ * nss_map_t_log_tx_msg()
+ * Log messages transmitted to FW.
+ */
+void nss_map_t_log_tx_msg(struct nss_map_t_msg *ntm)
+{
+ if (ntm->cm.type >= NSS_MAP_T_MSG_MAX) {
+ nss_warning("%p: Invalid message type\n", ntm);
+ return;
+ }
+
+ nss_info("%p: type[%d]:%s\n", ntm, ntm->cm.type, nss_map_t_log_message_types_str[ntm->cm.type]);
+ nss_map_t_log_verbose(ntm);
+}
+
+/*
+ * nss_map_t_log_rx_msg()
+ * Log messages received from FW.
+ */
+void nss_map_t_log_rx_msg(struct nss_map_t_msg *ntm)
+{
+ if (ntm->cm.response >= NSS_CMN_RESPONSE_LAST) {
+ nss_warning("%p: Invalid response\n", ntm);
+ return;
+ }
+
+ if (ntm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ntm->cm.response == NSS_CMN_RESPONSE_ACK)) {
+ nss_info("%p: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type,
+ nss_map_t_log_message_types_str[ntm->cm.type],
+ ntm->cm.response, nss_cmn_response_str[ntm->cm.response]);
+ goto verbose;
+ }
+
+ nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n",
+ ntm, ntm->cm.type, nss_map_t_log_message_types_str[ntm->cm.type],
+ ntm->cm.response, nss_cmn_response_str[ntm->cm.response]);
+
+verbose:
+ nss_map_t_log_verbose(ntm);
+}
diff --git a/nss_map_t_log.h b/nss_map_t_log.h
new file mode 100644
index 0000000..3944889
--- /dev/null
+++ b/nss_map_t_log.h
@@ -0,0 +1,41 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+#ifndef __NSS_MAP_T_LOG_H
+#define __NSS_MAP_T_LOG_H
+
+/*
+ * nss_map_t.h
+ * NSS MAP_T header file.
+ */
+
+/*
+ * Logger APIs
+ */
+
+/*
+ * nss_map_t_log_tx_msg
+ * Logs a map_t message that is sent to the NSS firmware.
+ */
+void nss_map_t_log_tx_msg(struct nss_map_t_msg *ntm);
+
+/*
+ * nss_map_t_log_rx_msg
+ * Logs a map_t message that is received from the NSS firmware.
+ */
+void nss_map_t_log_rx_msg(struct nss_map_t_msg *ntm);
+
+#endif /* __NSS_MAP_T_LOG_H */
diff --git a/nss_meminfo.c b/nss_meminfo.c
index 719a4aa..1a0d36f 100644
--- a/nss_meminfo.c
+++ b/nss_meminfo.c
@@ -305,6 +305,11 @@
mem_ctx->logbuffer = (struct nss_log_descriptor *)kern_addr;
}
+ if (!strcmp(r->name, "c2c_descs_if_mem_map")) {
+ mem_ctx->c2c_start_memtype = mtype;
+ mem_ctx->c2c_start_dma = dma_addr;
+ }
+
/*
* Flush the updated meminfo request.
*/
diff --git a/nss_meminfo.h b/nss_meminfo.h
index d2f5d1e..c9bb3b9 100644
--- a/nss_meminfo.h
+++ b/nss_meminfo.h
@@ -115,6 +115,8 @@
struct nss_log_descriptor *logbuffer; /* nss_logbuffer virtual address */
uint32_t logbuffer_dma; /* nss_logbuffer physical address */
enum nss_meminfo_memtype logbuffer_memtype; /* Memory type for logbuffer */
+ uint32_t c2c_start_dma; /* nss_c2c start physical address */
+ enum nss_meminfo_memtype c2c_start_memtype; /* Memory type for c2c_start */
struct nss_meminfo_map meminfo_map; /* Meminfo map */
struct nss_meminfo_block_list block_lists[NSS_MEMINFO_MEMTYPE_MAX];
/* Block lists for each memory type */
diff --git a/nss_oam.c b/nss_oam.c
index 1e31c1b..ce77e89 100644
--- a/nss_oam.c
+++ b/nss_oam.c
@@ -25,6 +25,7 @@
*/
#include "nss_tx_rx_common.h"
+#include "nss_oam_log.h"
/*
* nss_oam_rx_msg_handler()
@@ -36,6 +37,11 @@
nss_oam_msg_callback_t cb;
/*
+ * Trace Messages
+ */
+ nss_oam_log_rx_msg(nom);
+
+ /*
* Sanity check the message type
*/
if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_oam_msg)) {
@@ -74,6 +80,11 @@
{
struct nss_cmn_msg *ncm = &nom->cm;
+ /*
+ * Trace Messages
+ */
+ nss_oam_log_tx_msg(nom);
+
if (ncm->type > NSS_OAM_MSG_TYPE_MAX) {
nss_warning("%p: CMD type for oam module is invalid - %d", nss_ctx, ncm->type);
return NSS_TX_FAILURE_BAD_PARAM;
diff --git a/nss_oam_log.c b/nss_oam_log.c
new file mode 100644
index 0000000..9fb4823
--- /dev/null
+++ b/nss_oam_log.c
@@ -0,0 +1,101 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_oam_log.c
+ * NSS OAM logger file.
+ */
+
+#include "nss_core.h"
+
+/*
+ * nss_oam_log_message_types_str
+ * NSS OAM message strings
+ */
+static int8_t *nss_oam_log_message_types_str[NSS_OAM_MSG_TYPE_MAX] __maybe_unused = {
+ "OAM Message None",
+ "OAM Get FW Version",
+};
+
+/*
+ * nss_oam_log_get_fw_version_msg()
+ * Log NSS OAM GET FW Version.
+ */
+static void nss_oam_log_get_fw_version_msg(struct nss_oam_msg *nom)
+{
+ struct nss_oam_fw_ver *nofm __maybe_unused = &nom->msg.fw_ver;
+ nss_trace("%p: NSS OAM Get FW Version message \n"
+ "OAM FW Version: %p\n",
+ nofm, nofm->string);
+}
+
+/*
+ * nss_oam_log_verbose()
+ * Log message contents.
+ */
+static void nss_oam_log_verbose(struct nss_oam_msg *nom)
+{
+ switch (nom->cm.type) {
+ case NSS_OAM_MSG_TYPE_GET_FW_VER:
+ nss_oam_log_get_fw_version_msg(nom);
+ break;
+
+ default:
+ nss_trace("%p: Invalid message type\n", nom);
+ break;
+ }
+}
+
+/*
+ * nss_oam_log_tx_msg()
+ * Log messages transmitted to FW.
+ */
+void nss_oam_log_tx_msg(struct nss_oam_msg *nom)
+{
+ if (nom->cm.type >= NSS_OAM_MSG_TYPE_MAX) {
+ nss_warning("%p: Invalid message type\n", nom);
+ return;
+ }
+
+ nss_info("%p: type[%d]:%s\n", nom, nom->cm.type, nss_oam_log_message_types_str[nom->cm.type]);
+ nss_oam_log_verbose(nom);
+}
+
+/*
+ * nss_oam_log_rx_msg()
+ * Log messages received from FW.
+ */
+void nss_oam_log_rx_msg(struct nss_oam_msg *nom)
+{
+ if (nom->cm.response >= NSS_CMN_RESPONSE_LAST) {
+ nss_warning("%p: Invalid response\n", nom);
+ return;
+ }
+
+ if (nom->cm.response == NSS_CMN_RESPONSE_NOTIFY || (nom->cm.response == NSS_CMN_RESPONSE_ACK)) {
+ nss_info("%p: type[%d]:%s, response[%d]:%s\n", nom, nom->cm.type,
+ nss_oam_log_message_types_str[nom->cm.type],
+ nom->cm.response, nss_cmn_response_str[nom->cm.response]);
+ goto verbose;
+ }
+
+ nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n",
+ nom, nom->cm.type, nss_oam_log_message_types_str[nom->cm.type],
+ nom->cm.response, nss_cmn_response_str[nom->cm.response]);
+
+verbose:
+ nss_oam_log_verbose(nom);
+}
diff --git a/nss_oam_log.h b/nss_oam_log.h
new file mode 100644
index 0000000..b02611b
--- /dev/null
+++ b/nss_oam_log.h
@@ -0,0 +1,41 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+#ifndef __NSS_OAM_LOG_H
+#define __NSS_OAM_LOG_H
+
+/*
+ * nss_oam.h
+ * NSS OAM header file.
+ */
+
+/*
+ * Logger APIs
+ */
+
+/*
+ * nss_oam_log_tx_msg
+ * Logs a oam message that is sent to the NSS firmware.
+ */
+void nss_oam_log_tx_msg(struct nss_oam_msg *nom);
+
+/*
+ * nss_oam_log_rx_msg
+ * Logs a oam message that is received from the NSS firmware.
+ */
+void nss_oam_log_rx_msg(struct nss_oam_msg *nom);
+
+#endif /* __NSS_OAM_LOG_H */
diff --git a/nss_phys_if.c b/nss_phys_if.c
index 9c0ff00..7c35938 100644
--- a/nss_phys_if.c
+++ b/nss_phys_if.c
@@ -544,6 +544,24 @@
}
/*
+ * nss_phys_if_set_nexthop()
+ * Configures nexthop for an interface
+ */
+nss_tx_status_t nss_phys_if_set_nexthop(struct nss_ctx_instance *nss_ctx, uint32_t if_num, uint32_t nexthop)
+{
+ struct nss_phys_if_msg nim;
+
+ NSS_VERIFY_CTX_MAGIC(nss_ctx);
+ nss_info("%p: Phys If nexthop will be set to %d, id:%d\n", nss_ctx, nexthop, if_num);
+
+ nss_cmn_msg_init(&nim.cm, if_num, NSS_PHYS_IF_SET_NEXTHOP,
+ sizeof(struct nss_if_set_nexthop), nss_phys_if_callback, NULL);
+ nim.msg.if_msg.set_nexthop.nexthop = nexthop;
+
+ return nss_phys_if_msg_sync(nss_ctx, &nim);
+}
+
+/*
* nss_get_state()
* Return the NSS initialization state
*/
diff --git a/nss_phys_if.h b/nss_phys_if.h
index da381f6..06386c9 100644
--- a/nss_phys_if.h
+++ b/nss_phys_if.h
@@ -1,6 +1,6 @@
/*
**************************************************************************
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all copies.
@@ -120,6 +120,7 @@
NSS_PHYS_IF_PAUSE_ON_OFF = NSS_IF_PAUSE_ON_OFF,
NSS_PHYS_IF_VSI_ASSIGN = NSS_IF_VSI_ASSIGN,
NSS_PHYS_IF_VSI_UNASSIGN = NSS_IF_VSI_UNASSIGN,
+ NSS_PHYS_IF_SET_NEXTHOP = NSS_IF_SET_NEXTHOP,
NSS_PHYS_IF_EXTENDED_STATS_SYNC = NSS_IF_MAX_MSG_TYPES + 1,
NSS_PHYS_IF_MAX_MSG_TYPES
};
diff --git a/nss_portid.c b/nss_portid.c
index 41c5967..e3be15d 100644
--- a/nss_portid.c
+++ b/nss_portid.c
@@ -16,6 +16,7 @@
#include "nss_tx_rx_common.h"
#include "nss_portid_stats.h"
+#include "nss_portid_log.h"
/*
* Spinlock to protect portid interface create/destroy/update
@@ -51,6 +52,11 @@
BUG_ON(ncm->interface != NSS_PORTID_INTERFACE);
/*
+ * Trace Messages
+ */
+ nss_portid_log_rx_msg(npm);
+
+ /*
* Is this a valid request/response packet?
*/
if (ncm->type >= NSS_PORTID_MAX_MSG_TYPE) {
@@ -170,6 +176,11 @@
struct nss_cmn_msg *ncm = &msg->cm;
/*
+ * Trace Messages
+ */
+ nss_portid_log_tx_msg(msg);
+
+ /*
* Sanity check the message
*/
if (ncm->interface != NSS_PORTID_INTERFACE) {
diff --git a/nss_portid_log.c b/nss_portid_log.c
new file mode 100644
index 0000000..4ac1484
--- /dev/null
+++ b/nss_portid_log.c
@@ -0,0 +1,129 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_portid_log.c
+ * NSS PORTID logger file.
+ */
+
+#include "nss_core.h"
+
+/*
+ * nss_portid_log_message_types_str
+ * NSS PORTID message strings
+ */
+static int8_t *nss_portid_log_message_types_str[NSS_PORTID_MAX_MSG_TYPE] __maybe_unused = {
+ "PORTID Configure",
+ "PORTID Unconfigure",
+ "PORTID Stats",
+};
+
+/*
+ * nss_portid_log_configure_msg()
+ * Log NSS PORTID Configure.
+ */
+static void nss_portid_log_configure_msg(struct nss_portid_msg *npm)
+{
+ struct nss_portid_configure_msg *npcm __maybe_unused = &npm->msg.configure;
+ nss_trace("%p: NSS PORTID Configure message \n"
+ "PORTID Interface Number: %d\n"
+ "PORTID Interface ID: %d\n"
+ "PORTID GMAC ID: %d\n",
+ npcm, npcm->port_if_num,
+ npcm->port_id, npcm->gmac_id);
+}
+
+/*
+ * nss_portid_log_unconfigure_msg()
+ * Log NSS PORTID Unconfigure.
+ */
+static void nss_portid_log_unconfigure_msg(struct nss_portid_msg *npm)
+{
+ struct nss_portid_unconfigure_msg *npum __maybe_unused = &npm->msg.unconfigure;
+ nss_trace("%p: NSS PORTID Configure message \n"
+ "PORTID Interface Number: %d\n"
+ "PORTID Interface ID: %d\n",
+ npum, npum->port_if_num,
+ npum->port_id);
+}
+
+/*
+ * nss_portid_log_verbose()
+ * Log message contents.
+ */
+static void nss_portid_log_verbose(struct nss_portid_msg *npm)
+{
+ switch (npm->cm.type) {
+ case NSS_PORTID_CONFIGURE_MSG:
+ nss_portid_log_configure_msg(npm);
+ break;
+
+ case NSS_PORTID_UNCONFIGURE_MSG:
+ nss_portid_log_unconfigure_msg(npm);
+ break;
+
+ case NSS_PORTID_STATS_SYNC_MSG:
+ /*
+ * No log for valid stats message.
+ */
+ break;
+
+ default:
+ nss_trace("%p: Invalid message type\n", npm);
+ break;
+ }
+}
+
+/*
+ * nss_portid_log_tx_msg()
+ * Log messages transmitted to FW.
+ */
+void nss_portid_log_tx_msg(struct nss_portid_msg *npm)
+{
+ if (npm->cm.type >= NSS_PORTID_MAX_MSG_TYPE) {
+ nss_warning("%p: Invalid message type\n", npm);
+ return;
+ }
+
+ nss_info("%p: type[%d]:%s\n", npm, npm->cm.type, nss_portid_log_message_types_str[npm->cm.type]);
+ nss_portid_log_verbose(npm);
+}
+
+/*
+ * nss_portid_log_rx_msg()
+ * Log messages received from FW.
+ */
+void nss_portid_log_rx_msg(struct nss_portid_msg *npm)
+{
+ if (npm->cm.response >= NSS_CMN_RESPONSE_LAST) {
+ nss_warning("%p: Invalid response\n", npm);
+ return;
+ }
+
+ if (npm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (npm->cm.response == NSS_CMN_RESPONSE_ACK)) {
+ nss_info("%p: type[%d]:%s, response[%d]:%s\n", npm, npm->cm.type,
+ nss_portid_log_message_types_str[npm->cm.type],
+ npm->cm.response, nss_cmn_response_str[npm->cm.response]);
+ goto verbose;
+ }
+
+ nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s\n",
+ npm, npm->cm.type, nss_portid_log_message_types_str[npm->cm.type],
+ npm->cm.response, nss_cmn_response_str[npm->cm.response]);
+
+verbose:
+ nss_portid_log_verbose(npm);
+}
diff --git a/nss_portid_log.h b/nss_portid_log.h
new file mode 100644
index 0000000..54d904f
--- /dev/null
+++ b/nss_portid_log.h
@@ -0,0 +1,41 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+#ifndef __NSS_PORTID_LOG_H
+#define __NSS_PORTID_LOG_H
+
+/*
+ * nss_portid.h
+ * NSS PORTID header file.
+ */
+
+/*
+ * Logger APIs
+ */
+
+/*
+ * nss_portid_log_tx_msg
+ * Logs a portid message that is sent to the NSS firmware.
+ */
+void nss_portid_log_tx_msg(struct nss_portid_msg *ntm);
+
+/*
+ * nss_portid_log_rx_msg
+ * Logs a portid message that is received from the NSS firmware.
+ */
+void nss_portid_log_rx_msg(struct nss_portid_msg *ntm);
+
+#endif /* __NSS_PORTID_LOG_H */
diff --git a/nss_trustsec_tx.c b/nss_trustsec_tx.c
index 842fd53..b84da30 100644
--- a/nss_trustsec_tx.c
+++ b/nss_trustsec_tx.c
@@ -16,6 +16,7 @@
#include "nss_tx_rx_common.h"
#include "nss_trustsec_tx_stats.h"
+#include "nss_trustsec_tx_log.h"
#define NSS_TRUSTSEC_TX_TIMEOUT 3000 /* 3 Seconds */
@@ -41,6 +42,11 @@
BUG_ON(ncm->interface != NSS_TRUSTSEC_TX_INTERFACE);
/*
+ * Trace messages.
+ */
+ nss_trustsec_tx_log_rx_msg(npm);
+
+ /*
* Is this a valid request/response packet?
*/
if (ncm->type >= NSS_TRUSTSEC_TX_MAX_MSG_TYPE) {
@@ -100,6 +106,11 @@
struct nss_cmn_msg *ncm = &msg->cm;
/*
+ * Trace messages.
+ */
+ nss_trustsec_tx_log_tx_msg(msg);
+
+ /*
* Sanity check the message
*/
if (ncm->interface != NSS_TRUSTSEC_TX_INTERFACE) {
diff --git a/nss_trustsec_tx_log.c b/nss_trustsec_tx_log.c
new file mode 100644
index 0000000..d795f71
--- /dev/null
+++ b/nss_trustsec_tx_log.c
@@ -0,0 +1,149 @@
+/*
+ **************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ **************************************************************************
+ */
+
+/*
+ * nss_trustsec_tx_log.c
+ * NSS TRUSTSEC_TX logger file.
+ */
+
+#include "nss_core.h"
+
+/*
+ * nss_trustsec_tx_log_message_types_str
+ * TRUSTSEC_TX message strings
+ */
+static int8_t *nss_trustsec_tx_log_message_types_str[NSS_TRUSTSEC_TX_MAX_MSG_TYPE] __maybe_unused = {
+ "TRUSTSEC_TX Configure Message",
+ "TRUSTSEC_TX Unconfigure Message",
+ "TRUSTSEC_TX Stats Sync",
+};
+
+/*
+ * nss_trustsec_tx_log_error_response_types_str
+ * Strings for error types for TRUSTSEC_TX messages
+ */
+static int8_t *nss_trustsec_tx_log_error_response_types_str[NSS_TRUSTSEC_TX_ERR_UNKNOWN] __maybe_unused = {
+ "TRUSTSEC_TX Invalid Source Interface",
+ "TRUSTSEC_TX Reconfigure Source Interface"
+ "TRUSTSEC_TX Destination Interface Not Found",
+ "TRUSTSEC_TX Not Configured",
+ "TRUSTSEC_TX Unknown Error",
+};
+
+/*
+ * nss_trustsec_tx_log_configure_msg()
+ * Log NSS TRUSTSEC_TX configure message.
+ */
+static void nss_trustsec_tx_log_configure_msg(struct nss_trustsec_tx_msg *ntm)
+{
+ struct nss_trustsec_tx_configure_msg *ntcm __maybe_unused = &ntm->msg.configure;
+ nss_trace("%p: NSS TRUSTSEC_TX Configure Message:\n"
+ "TRUSTSEC_TX Source: %d\n"
+ "TRUSTSEC_TX Destination: %d\n"
+ "TRUSTSEC_TX Security Group Tag: %d\n",
+ ntcm, ntcm->src,
+ ntcm->dest, ntcm->sgt);
+}
+
+/*
+ * nss_trustsec_tx_log_unconfigure_msg()
+ * Log NSS TRUSTSEC_TX unconfigure message.
+ */
+static void nss_trustsec_tx_log_unconfigure_msg(struct nss_trustsec_tx_msg *ntm)
+{
+ struct nss_trustsec_tx_unconfigure_msg *ntcm __maybe_unused = &ntm->msg.unconfigure;
+ nss_trace("%p: NSS TRUSTSEC_TX Unconfigure Message:\n"
+ "TRUSTSEC_TX Source: %d\n"
+ "TRUSTSEC_TX Security Group Tag: %d\n",
+ ntcm, ntcm->src, ntcm->sgt);
+}
+
+/*
+ * nss_trustsec_tx_log_verbose()
+ * Log message contents.
+ */
+static void nss_trustsec_tx_log_verbose(struct nss_trustsec_tx_msg *ntm)
+{
+ switch (ntm->cm.type) {
+ case NSS_TRUSTSEC_TX_CONFIGURE_MSG:
+ nss_trustsec_tx_log_configure_msg(ntm);
+ break;
+
+ case NSS_TRUSTSEC_TX_UNCONFIGURE_MSG:
+ nss_trustsec_tx_log_unconfigure_msg(ntm);
+ break;
+
+ case NSS_TRUSTSEC_TX_STATS_SYNC_MSG:
+ /*
+ * No log for valid stats message.
+ */
+ break;
+
+ default:
+ nss_warning("%p: Invalid message type\n", ntm);
+ break;
+ }
+}
+
+/*
+ * nss_trustsec_tx_log_tx_msg()
+ * Log messages transmitted to FW.
+ */
+void nss_trustsec_tx_log_tx_msg(struct nss_trustsec_tx_msg *ntm)
+{
+ if (ntm->cm.type >= NSS_TRUSTSEC_TX_MAX_MSG_TYPE) {
+ nss_warning("%p: Invalid message type\n", ntm);
+ return;
+ }
+
+ nss_info("%p: type[%d]:%s\n", ntm, ntm->cm.type, nss_trustsec_tx_log_message_types_str[ntm->cm.type]);
+ nss_trustsec_tx_log_verbose(ntm);
+}
+
+/*
+ * nss_trustsec_tx_log_rx_msg()
+ * Log messages received from FW.
+ */
+void nss_trustsec_tx_log_rx_msg(struct nss_trustsec_tx_msg *ntm)
+{
+ if (ntm->cm.response >= NSS_CMN_RESPONSE_LAST) {
+ nss_warning("%p: Invalid response\n", ntm);
+ return;
+ }
+
+ if (ntm->cm.response == NSS_CMN_RESPONSE_NOTIFY || (ntm->cm.response == NSS_CMN_RESPONSE_ACK)) {
+ nss_info("%p: type[%d]:%s, response[%d]:%s\n", ntm, ntm->cm.type,
+ nss_trustsec_tx_log_message_types_str[ntm->cm.type],
+ ntm->cm.response, nss_cmn_response_str[ntm->cm.response]);
+ goto verbose;
+ }
+
+ if (ntm->cm.error >= NSS_TRUSTSEC_TX_ERR_UNKNOWN) {
+ nss_warning("%p: msg failure - type[%d]:%s, response[%d]:%s, error[%d]:Invalid error\n",
+ ntm, ntm->cm.type, nss_trustsec_tx_log_message_types_str[ntm->cm.type],
+ ntm->cm.response, nss_cmn_response_str[ntm->cm.response],
+ ntm->cm.error);
+ goto verbose;
+ }
+
+ nss_info("%p: msg nack - type[%d]:%s, response[%d]:%s, error[%d]:%s\n",
+ ntm, ntm->cm.type, nss_trustsec_tx_log_message_types_str[ntm->cm.type],
+ ntm->cm.response, nss_cmn_response_str[ntm->cm.response],
+ ntm->cm.error, nss_trustsec_tx_log_error_response_types_str[ntm->cm.error]);
+
+verbose:
+ nss_trustsec_tx_log_verbose(ntm);
+}
diff --git a/nss_trustsec_tx_log.h b/nss_trustsec_tx_log.h
new file mode 100644
index 0000000..58633c9
--- /dev/null
+++ b/nss_trustsec_tx_log.h
@@ -0,0 +1,37 @@
+/*
+ ******************************************************************************
+ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all copies.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ * ****************************************************************************
+ */
+
+#ifndef __NSS_TRUSTSEC_TX_LOG_H__
+#define __NSS_TRUSTSEC_TX_LOG_H__
+
+/*
+ * nss_trustsec_tx_log.h
+ * NSS TRUSTSEC_TX Log Header File
+ */
+
+/*
+ * nss_trustsec_tx_log_tx_msg
+ * Logs a trustsec_tx message that is sent to the NSS firmware.
+ */
+void nss_trustsec_tx_log_tx_msg(struct nss_trustsec_tx_msg *ncm);
+
+/*
+ * nss_trustsec_tx_log_rx_msg
+ * Logs a trustsec_tx message that is received from the NSS firmware.
+ */
+void nss_trustsec_tx_log_rx_msg(struct nss_trustsec_tx_msg *ncm);
+
+#endif /* __NSS_TRUSTSEC_TX_LOG_H__ */