summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/freescale/dpa/capwap/dpaa_capwap_op.c
diff options
context:
space:
mode:
authorPan Jiafei <Jiafei.Pan@freescale.com>2014-07-30 07:41:01 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:39:17 (GMT)
commitd3515fe84958bd0b20ddddc600de5ea198e597d3 (patch)
treed9044cf7c33ff4b70d6a626bfa668dd0bdebb495 /drivers/net/ethernet/freescale/dpa/capwap/dpaa_capwap_op.c
parent2ae30dce496912131c5a5a401cf2ea13e8210b11 (diff)
downloadlinux-fsl-qoriq-d3515fe84958bd0b20ddddc600de5ea198e597d3.tar.xz
capwap: add capwap support
CAPWAP stands for Control and Provisioning of Wireless Access Points. CAPWAP is a standard, interoperable protocol that enables a controller to manage a collection of wireless access points. There are three drivers in Kernel Space: CAPWAP Domain driver, CAPWAP Bridge driver and CAPWAP Tunnel driver. CAPWAP Domain Driver implements configuration for CAPWAP Domain, including PCD configuration and FQs setup. User must configure and initialize CAPWAP domain before CAPWAP Tunnel and CAPWAP Bridge works. CAPWAP Tunnel Driver is a misc device driver, which registers four misc devices for four CAPWAP tunnels: fsl-capwap-ctrl-dtls, fsl-capwap-ctl-n-dtls, fsl-capwap-data-dtls, fsl-capwap-data-n-dtls. The misc device provides file-operation to transmit/receive DTLS/non-DTLS packets. For example, read from the device fsl-capwap-ctrl-dtls can receive DTLS control packet; Write to the device fsl-capwap-ctrl-dtls can transmit DTLS control packet. The CAPWAP Bridge Driver is also a misc device driver; it can bridge packets between PCIe NIC and CAPWAP data tunnels. To support capwap drivers, there should be a shared ethernet port in dts file to use as CAPWAP Ethernet port. Signed-off-by: Pan Jiafei <Jiafei.Pan@freescale.com> Change-Id: I7c99191156ebee5dd43673d20fb5c8469a780546 Reviewed-on: http://git.am.freescale.net:8181/21438 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Jianhua Xie <jianhua.xie@freescale.com> Reviewed-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/dpa/capwap/dpaa_capwap_op.c')
-rw-r--r--drivers/net/ethernet/freescale/dpa/capwap/dpaa_capwap_op.c96
1 files changed, 96 insertions, 0 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/capwap/dpaa_capwap_op.c b/drivers/net/ethernet/freescale/dpa/capwap/dpaa_capwap_op.c
new file mode 100644
index 0000000..3074a68
--- /dev/null
+++ b/drivers/net/ethernet/freescale/dpa/capwap/dpaa_capwap_op.c
@@ -0,0 +1,96 @@
+/* Copyright 2014 Freescale Semiconductor, Inc.
+ *
+ * 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
+ * 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 distribution.
+ * * Neither the name of Freescale Semiconductor nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``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 Freescale Semiconductor 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 OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <compat.h>
+#include <linux/kthread.h>
+#include "lnxwrp_fm.h"
+#include "../offline_port.h"
+#include "../dpaa_eth.h"
+#include "../dpaa_eth_common.h"
+#include "dpaa_capwap.h"
+#include "dpaa_capwap_fq.h"
+#include "dpaa_capwap_domain.h"
+
+uint8_t get_capwap_bpid(struct net_device *net_dev)
+{
+ struct dpa_priv_s *priv;
+
+ priv = netdev_priv(net_dev);
+ return priv->dpa_bp->bpid;
+}
+
+int op_init(struct t_Port *port, struct net_device *net_dev)
+{
+ struct device_node *dpa_oh_node;
+ bool is_found = false;
+ struct platform_device *oh_dev;
+ struct dpa_oh_config_s *oh_config;
+ int ret;
+ uint16_t channel;
+ struct dpa_fq *fq;
+ uint32_t def_fqid, err_fqid;
+ t_LnxWrpFmPortDev *fm_port_dev = NULL;
+ t_LnxWrpFmDev *fm_dev = NULL;
+ struct task_struct *kth;
+ static struct of_device_id dpa_oh_node_of_match[] = {
+ { .compatible = "fsl,dpa-oh", },
+ { /* end of list */ },
+ };
+
+
+ for_each_matching_node(dpa_oh_node, dpa_oh_node_of_match) {
+ oh_dev = of_find_device_by_node(dpa_oh_node);
+ oh_config = dev_get_drvdata(&oh_dev->dev);
+ if (oh_config == NULL)
+ continue;
+
+ fm_port_dev = (t_LnxWrpFmPortDev *)oh_config->oh_port;
+ fm_dev = fm_port_dev->h_LnxWrpFmDev;
+ if (fm_port_dev->settings.param.portId == port->port_id &&
+ fm_dev->id == port->fm_id) {
+ is_found = true;
+ port->tx_ch = fm_port_dev->txCh;
+ def_fqid = oh_config->error_fqid;
+ err_fqid = oh_config->default_fqid;
+ break;
+ }
+ }
+
+ if (!is_found) {
+ pr_err("Can't found this dpa OH port:%d,%d\n", port->fm_id,
+ port->port_id);
+ return -ENODEV;
+ }
+
+ return 0;
+}