Re-design handling of physical and virtual interfaces
1) Fix message numbering by basing nss_virt_if.h and nss_phys_if.h on nss_if.h
2) Create backward compatible layer for virtual in nss_tx_rx_virt_if.c
3) Create new API in nss_virt_if.c
4) Create backward compatible layer for phsical in nss_tx_rx_phys_if.c
5) Create new API in nss_phys.c
Change-Id: Ibe8c8e60b5e841f0aeb201f8ad7be171c9ae979a
Signed-off-by: Sol Kavy <skavy@codeaurora.org>
diff --git a/nss_ipv4.c b/nss_ipv4.c
index a46b5e6..7b8a09a 100755
--- a/nss_ipv4.c
+++ b/nss_ipv4.c
@@ -30,58 +30,31 @@
* Update driver specific information from the messsage.
*/
#if 0
-static void nss_ipv4_driver_update(void)
+static void nss_ipv4_driver_conn_update(struct nss_ipv4_msg *nim)
{
/*
* Update statistics maintained by NSS driver
*/
spin_lock_bh(&nss_top->stats_lock);
-
nss_top->stats_ipv4[NSS_STATS_IPV4_ACCELERATED_RX_PKTS] += nirs->flow_rx_packet_count + nirs->return_rx_packet_count;
nss_top->stats_ipv4[NSS_STATS_IPV4_ACCELERATED_RX_BYTES] += nirs->flow_rx_byte_count + nirs->return_rx_byte_count;
nss_top->stats_ipv4[NSS_STATS_IPV4_ACCELERATED_TX_PKTS] += nirs->flow_tx_packet_count + nirs->return_tx_packet_count;
nss_top->stats_ipv4[NSS_STATS_IPV4_ACCELERATED_TX_BYTES] += nirs->flow_tx_byte_count + nirs->return_tx_byte_count;
-
- /*
- * Update the PPPoE interface stats, if there is any PPPoE session on the interfaces.
- */
- if (nirs->flow_pppoe_session_id) {
- pppoe_dev = ppp_session_to_netdev(nirs->flow_pppoe_session_id, (uint8_t *)nirs->flow_pppoe_remote_mac);
- if (pppoe_dev) {
- ppp_update_stats(pppoe_dev, nirs->flow_rx_packet_count, nirs->flow_rx_byte_count,
- nirs->flow_tx_packet_count, nirs->flow_tx_byte_count);
- dev_put(pppoe_dev);
- }
- }
-
- if (nirs->return_pppoe_session_id) {
- pppoe_dev = ppp_session_to_netdev(nirs->return_pppoe_session_id, (uint8_t *)nirs->return_pppoe_remote_mac);
- if (pppoe_dev) {
- ppp_update_stats(pppoe_dev, nirs->return_rx_packet_count, nirs->return_rx_byte_count,
- nirs->return_tx_packet_count, nirs->return_tx_byte_count);
- dev_put(pppoe_dev);
- }
- }
-
- /*
- * TODO: Update per dev accelerated statistics
- */
spin_unlock_bh(&nss_top->stats_lock);
}
#endif
/*
- * nss_ipv4_handler()
+ * nss_ipv4_rx_msg_handler()
* Handle NSS -> HLOS messages for IPv4 bridge/route
*/
-static void nss_ipv4_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm, __attribute__((unused))void *app_data)
+static void nss_ipv4_rx_msg_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm, __attribute__((unused))void *app_data)
{
struct nss_ipv4_msg *nim = (struct nss_ipv4_msg *)ncm;
-
/*
* TODO: Turn back on for new APIs
*/
-// nss_ipv4_msg_callback_t cb;
+// nss_ipv4_rx_msg_callback_t cb;
BUG_ON(ncm->interface != NSS_IPV4_RX_INTERFACE);
@@ -98,7 +71,6 @@
return;
}
-
/*
* Update the callback and app_data for NOTIFY messages, IPv4 sends all notify messages
* to the same callback/app_data.
@@ -126,10 +98,12 @@
break;
}
+#if 0
/*
* Local driver updates for ipv4.
*/
-#if 0
+ nss_ipv4_driver_update(nim);
+
/*
* Do we have a callback?
*/
@@ -140,7 +114,7 @@
/*
* Callback
*/
- cb = (nss_ipv4_msg_callback_t)ncm->cb;
+ cb = (nss_ipv4_rx_msg_callback_t)ncm->cb;
cb((void *)ncm->app_data, nim);
#endif
}
@@ -257,9 +231,9 @@
* nss_ipv4_register_handler()
* Register our handler to receive messages for this interface
*/
-void nss_ipv4_register_handler()
+void nss_ipv4_register_handler(void)
{
- if (nss_core_register_handler(NSS_IPV4_RX_INTERFACE, nss_ipv4_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
+ if (nss_core_register_handler(NSS_IPV4_RX_INTERFACE, nss_ipv4_rx_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
nss_warning("IPv4 handler failed to register");
}
}