| /* |
| <:copyright-BRCM:2016:DUAL/GPL:standard |
| |
| Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| All Rights Reserved |
| |
| Unless you and Broadcom execute a separate written software license |
| agreement governing use of this software, this software is licensed |
| to you under the terms of the GNU General Public License version 2 |
| (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| with the following added to such license: |
| |
| As a special exception, the copyright holders of this software give |
| you permission to link this software with independent modules, and |
| to copy and distribute the resulting executable under terms of your |
| choice, provided that you also meet, for each linked independent |
| module, the terms and conditions of the license of that module. |
| An independent module is a module which is not derived from this |
| software. The special exception does not apply to any modifications |
| of the software. |
| |
| Not withstanding the above, under no circumstances may you combine |
| this software in any way with any other Broadcom software provided |
| under a license other than the GPL, without Broadcom's express prior |
| written consent. |
| |
| :> |
| */ |
| |
| #include "bcmtr_internal.h" |
| #include "bcmtr_interface.h" |
| #include "bcmtr_plugin.h" |
| |
| |
| #ifdef BCMTR_UDP_SUPPORT |
| |
| uint32_t bcmtr_host_ip = BCMTR_TR_UDP_HOST_IP; |
| uint16_t bcmtr_host_udp_port = BCMTR_TR_UDP_HOST_PORT; |
| uint32_t bcmtr_olt_ip[BCMTR_MAX_OLTS]; |
| uint16_t bcmtr_olt_udp_port[BCMTR_MAX_OLTS]; |
| |
| #endif |
| |
| /* Fetch configuration |
| * set-up transport driver plugin |
| * Eventually this function can read from config file or device control driver. |
| * For now - hardcode |
| */ |
| bcmos_errno bcmtr_cfg_get(bcmolt_devid device, bcmtr_cfg *cfg, bcmtr_driver *driver) |
| { |
| bcmos_errno rc = BCM_ERR_NOT_SUPPORTED; |
| |
| cfg->max_retries = BCMTR_MAX_RETRIES; |
| cfg->msg_timeout = BCMTR_MSG_TIMEOUT; |
| cfg->max_fragments = BCMTR_MAX_FRAGMENTS; |
| cfg->max_requests = BCMTR_MAX_REQUESTS; |
| cfg->max_autos = BCMTR_MAX_AUTOS; |
| cfg->max_mtu = BCMTR_MAX_MTU_SIZE; |
| cfg->msg_wait_timeout = BCMTR_MSG_WAIT_MS; |
| cfg->msg_ready_timeout = BCMTR_MSG_READY_MS; |
| cfg->plugin_cfg.type = BCMTR_TR_TYPE; |
| cfg->rx_thread_priority = TASK_PRIORITY_TRANSPORT_RX; |
| |
| #ifdef BCMTR_UDP_SUPPORT |
| #ifdef BCM_SUBSYSTEM_HOST |
| cfg->plugin_cfg.x.udp.my_ip = bcmtr_host_ip; |
| cfg->plugin_cfg.x.udp.remote_ip = bcmtr_olt_ip[device]; |
| cfg->plugin_cfg.x.udp.my_port = bcmtr_host_udp_port + device; |
| cfg->plugin_cfg.x.udp.remote_port = bcmtr_olt_udp_port[device]; |
| #else |
| cfg->plugin_cfg.x.udp.my_ip = bcmtr_olt_ip[device]; |
| cfg->plugin_cfg.x.udp.remote_ip = bcmtr_host_ip; |
| cfg->plugin_cfg.x.udp.my_port = bcmtr_olt_udp_port[device]; |
| cfg->plugin_cfg.x.udp.remote_port = bcmtr_host_udp_port + device; |
| #endif |
| #endif |
| |
| rc = bcmtr_plugin_init(&cfg->plugin_cfg, driver); |
| |
| return rc; |
| } |
| |