aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wwan
AgeCommit message (Collapse)AuthorFilesLines
2022-11-07net: wwan: mhi: fix memory leak in mhi_mbim_dellinkHW He1-0/+1
MHI driver registers network device without setting the needs_free_netdev flag, and does NOT call free_netdev() when unregisters network device, which causes a memory leak. This patch sets needs_free_netdev to true when registers network device, which makes netdev subsystem call free_netdev() automatically after unregister_netdevice(). Fixes: aa730a9905b7 ("net: wwan: Add MHI MBIM network driver") Signed-off-by: HW He <[email protected]> Signed-off-by: Zhaoping Shu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-07net: wwan: iosm: fix memory leak in ipc_wwan_dellinkHW He1-0/+1
IOSM driver registers network device without setting the needs_free_netdev flag, and does NOT call free_netdev() when unregisters network device, which causes a memory leak. This patch sets needs_free_netdev to true when registers network device, which makes netdev subsystem call free_netdev() automatically after unregister_netdevice(). Fixes: 2a54f2c77934 ("net: iosm: net driver") Signed-off-by: HW He <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Signed-off-by: Zhaoping Shu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-07net: wwan: t7xx: Add NAPI supportHaijun Liu5-166/+161
Replace the work queue based RX flow with a NAPI implementation Remove rx_thread and dpmaif_rxq_work. Enable GRO on RX path. Introduce dummy network device. its responsibility is - Binds one NAPI object for each DL HW queue and acts as the agent of all those network devices. - Use NAPI object to poll DL packets. - Helps to dispatch each packet to the network interface. Signed-off-by: Haijun Liu <[email protected]> Co-developed-by: Sreehari Kancharla <[email protected]> Signed-off-by: Sreehari Kancharla <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Acked-by: Ricardo Martinez <[email protected]> Acked-by: M Chetan Kumar <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-07net: wwan: t7xx: Use needed_headroom instead of hard_header_lenIlpo Järvinen1-1/+1
hard_header_len is used by gro_list_prepare() but on Rx, there is no header so use needed_headroom instead. Signed-off-by: Ilpo Järvinen <[email protected]> Signed-off-by: Sreehari Kancharla <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-02net: wwan: iosm: add rpc interface for xmm modemsShane Parslow2-1/+5
Add a new iosm wwan port that connects to the modem rpc interface. This interface provides a configuration channel, and in the case of the 7360, is the only way to configure the modem (as it does not support mbim). The new interface is compatible with existing software, such as open_xdatachannel.py from the xmm7360-pci project [1]. [1] https://github.com/xmm7360/xmm7360-pci Signed-off-by: Shane Parslow <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-02net: wwan: t7xx: Add port for modem loggingM Chetan Kumar8-0/+144
The Modem Logging (MDL) port provides an interface to collect modem logs for debugging purposes. MDL is supported by the relay interface, and the mtk_t7xx port infrastructure. MDL allows user-space apps to control logging via mbim command and to collect logs via the relay interface, while port infrastructure facilitates communication between the driver and the modem. Signed-off-by: Moises Veleta <[email protected]> Signed-off-by: M Chetan Kumar <[email protected]> Signed-off-by: Devegowda Chandrashekar <[email protected]> Acked-by: Ricardo Martinez <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-11-02net: wwan: t7xx: use union to group port type specific dataM Chetan Kumar2-9/+13
Use union inside t7xx_port to group port type specific data members. Signed-off-by: M Chetan Kumar <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-10-31rtnetlink: pass netlink message header and portid to rtnl_configure_link()Hangbin Liu1-1/+1
This patch pass netlink message header and portid to rtnl_configure_link() All the functions in this call chain need to add the parameters so we can use them in the last call rtnl_notify(), and notify the userspace about the new link info if NLM_F_ECHO flag is set. - rtnl_configure_link() - __dev_notify_flags() - rtmsg_ifinfo() - rtmsg_ifinfo_event() - rtmsg_ifinfo_build_skb() - rtmsg_ifinfo_send() - rtnl_notify() Also move __dev_notify_flags() declaration to net/core/dev.h, as Jakub suggested. Signed-off-by: Hangbin Liu <[email protected]> Reviewed-by: Guillaume Nault <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
2022-10-28net: Remove the obsolte u64_stats_fetch_*_irq() users (drivers).Thomas Gleixner1-4/+4
Now that the 32bit UP oddity is gone and 32bit uses always a sequence count, there is no need for the fetch_irq() variants anymore. Convert to the regular interface. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
2022-10-19wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new()Yang Yingliang1-1/+1
Inject fault while probing module, if device_register() fails, but the refcount of kobject is not decreased to 0, the name allocated in dev_set_name() is leaked. Fix this by calling put_device(), so that name can be freed in callback function kobject_cleanup(). unreferenced object 0xffff88810152ad20 (size 8): comm "modprobe", pid 252, jiffies 4294849206 (age 22.713s) hex dump (first 8 bytes): 68 77 73 69 6d 30 00 ff hwsim0.. backtrace: [<000000009c3504ed>] __kmalloc_node_track_caller+0x44/0x1b0 [<00000000c0228a5e>] kvasprintf+0xb5/0x140 [<00000000cff8c21f>] kvasprintf_const+0x55/0x180 [<0000000055a1e073>] kobject_set_name_vargs+0x56/0x150 [<000000000a80b139>] dev_set_name+0xab/0xe0 Fixes: f36a111a74e7 ("wwan_hwsim: WWAN device simulator") Signed-off-by: Yang Yingliang <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Acked-by: Sergey Ryazanov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-10-07Merge tag 'tty-6.1-rc1' of ↵Linus Torvalds1-0/+1
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty Pull tty/serial driver updates from Greg KH: "Here is the big set of TTY and Serial driver updates for 6.1-rc1. Lots of cleanups in here, no real new functionality this time around, with the diffstat being that we removed more lines than we added! Included in here are: - termios unification cleanups from Al Viro, it's nice to finally get this work done - tty serial transmit cleanups in various drivers in preparation for more cleanup and unification in future releases (that work was not ready for this release) - n_gsm fixes and updates - ktermios cleanups and code reductions - dt bindings json conversions and updates for new devices - some serial driver updates for new devices - lots of other tiny cleanups and janitorial stuff. Full details in the shortlog. All of these have been in linux-next for a while with no reported issues" * tag 'tty-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (102 commits) serial: cpm_uart: Don't request IRQ too early for console port tty: serial: do unlock on a common path in altera_jtaguart_console_putc() tty: serial: unify TX space reads under altera_jtaguart_tx_space() tty: serial: use FIELD_GET() in lqasc_tx_ready() tty: serial: extend lqasc_tx_ready() to lqasc_console_putchar() tty: serial: allow pxa.c to be COMPILE_TESTed serial: stm32: Fix unused-variable warning tty: serial: atmel: Add COMMON_CLK dependency to SERIAL_ATMEL serial: 8250: Fix restoring termios speed after suspend serial: Deassert Transmit Enable on probe in driver-specific way serial: 8250_dma: Convert to use uart_xmit_advance() serial: 8250_omap: Convert to use uart_xmit_advance() MAINTAINERS: Solve warning regarding inexistent atmel-usart binding serial: stm32: Deassert Transmit Enable on ->rs485_config() serial: ar933x: Deassert Transmit Enable on ->rs485_config() tty: serial: atmel: Use FIELD_PREP/FIELD_GET tty: serial: atmel: Make the driver aware of the existence of GCLK tty: serial: atmel: Only divide Clock Divisor if the IP is USART tty: serial: atmel: Separate mode clearing between UART and USART dt-bindings: serial: atmel,at91-usart: Add gclk as a possible USART clock ...
2022-10-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-2/+3
Merge in the left-over fixes before the net-next pull-request. Conflicts: drivers/net/ethernet/mediatek/mtk_ppe.c ae3ed15da588 ("net: ethernet: mtk_eth_soc: fix state in __mtk_foe_entry_clear") 9d8cb4c096ab ("net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc") https://lore.kernel.org/all/[email protected]/ kernel/bpf/helpers.c 8addbfc7b308 ("bpf: Gate dynptr API behind CAP_BPF") 5679ff2f138f ("bpf: Move bpf_loop and bpf_for_each_map_elem under CAP_BPF") 8a67f2de9b1d ("bpf: expose bpf_strtol and bpf_strtoul to all program types") https://lore.kernel.org/all/[email protected]/ Signed-off-by: Jakub Kicinski <[email protected]>
2022-10-03net: wwan: iosm: Call mutex_init before locking itMaxim Mikityanskiy1-2/+3
wwan_register_ops calls wwan_create_default_link, which ends up in the ipc_wwan_newlink callback that locks ipc_wwan->if_mutex. However, this mutex is not yet initialized by that point. Fix it by moving mutex_init above the wwan_register_ops call. This also makes the order of operations in ipc_wwan_init symmetric to ipc_wwan_deinit. Fixes: 83068395bbfc ("net: iosm: create default link via WWAN core") Signed-off-by: Maxim Mikityanskiy <[email protected]> Reviewed-by: M Chetan Kumar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-09-29wwan_hwsim: Use skb_put_data() instead of skb_put/memcpy pairShang XiaoJing1-3/+3
Use skb_put_data() instead of skb_put() and memcpy(), which is clear. Signed-off-by: Shang XiaoJing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2022-09-28net: wwan: iosm: Use skb_put_data() instead of skb_put/memcpy pairShang XiaoJing1-1/+1
Use skb_put_data() instead of skb_put() and memcpy(), which is clear. Signed-off-by: Shang XiaoJing <[email protected]> Reviewed-by: M Chetan Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-09-20net: wwan: mhi_wwan_ctrl: Add DUN2 to have a secondary AT portFabio Porcedda1-0/+1
In order to have a secondary AT port add "DUN2". Signed-off-by: Fabio Porcedda <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
2022-09-19net: wwan: t7xx: Fix return type of t7xx_ccmni_start_xmitNathan Huckleberry1-1/+1
The ndo_start_xmit field in net_device_ops is expected to be of type netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev). The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition. The return type of t7xx_ccmni_start_xmit should be changed from int to netdev_tx_t. Reported-by: Dan Carpenter <[email protected]> Link: https://github.com/ClangBuiltLinux/linux/issues/1703 Cc: [email protected] Signed-off-by: Nathan Huckleberry <[email protected]> Acked-by: Sergey Ryazanov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-09-19net: wwan: iosm: Fix return type of ipc_wwan_link_transmitNathan Huckleberry1-2/+2
The ndo_start_xmit field in net_device_ops is expected to be of type netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev). The mismatched return type breaks forward edge kCFI since the underlying function definition does not match the function hook definition. The return type of ipc_wwan_link_transmit should be changed from int to netdev_tx_t. Reported-by: Dan Carpenter <[email protected]> Link: https://github.com/ClangBuiltLinux/linux/issues/1703 Cc: [email protected] Signed-off-by: Nathan Huckleberry <[email protected]> Acked-by: Sergey Ryazanov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-09-09termios: get rid of non-UAPI asm/termios.hAl Viro1-0/+1
All non-UAPI asm/termios.h consist of include of UAPI counterpart and, possibly, include of linux/uaccess.h The latter can't be simply removed, even though nothing in linux/termios.h doesn't depend upon it anymore - there are several places that rely upon that indirect chain of includes to pull linux/uaccess.h. So the include needs to be lifted out of there - we lift into tty_driver.h, serdev.h and places that pull asm/termios.h, but none of * linux/uaccess.h (obvious) * net/sock.h (pulls uaccess.h) * linux/{tty,tty_driver,serdev}.h (tty.h pulls tty_driver.h) That leaves us just with the include of UAPI asm/termios.h, which is what <asm/termios.h> will resolve to if we simply remove non-UAPI header. Signed-off-by: Al Viro <[email protected]> Link: https://lore.kernel.org/r/YxDnKvYCHn/ogBUv@ZenIV Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-08-19Revert "Merge branch 'wwan-t7xx-fw-flashing-and-coredump-support'"Jakub Kicinski23-1560/+73
This reverts commit 5417197dd516a8e115aa69f62a7b7554b0c3829c, reversing changes made to 0630f64d25a0f0a8c6a9ce9fde8750b3b561e6f5. Reverting to allow addressing review comments. Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Jakub Kicinski <[email protected]>
2022-08-17net: wwan: t7xx: Enable devlink based fw flashing and coredump collectionM Chetan Kumar13-5/+932
This patch brings-in support for t7xx wwan device firmware flashing & coredump collection using devlink. Driver Registers with Devlink framework. Implements devlink ops flash_update callback that programs modem firmware. Creates region & snapshot required for device coredump log collection. On early detection of wwan device in fastboot mode driver sets up CLDMA0 HW tx/rx queues for raw data transfer then registers with devlink framework. Upon receiving firmware image & partition details driver sends fastboot commands for flashing the firmware. In this flow the fastboot command & response gets exchanged between driver and device. Once firmware flashing is success completion status is reported to user space application. Below is the devlink command usage for firmware flashing $devlink dev flash pci/$BDF file ABC.img component ABC Note: ABC.img is the firmware to be programmed to "ABC" partition. In case of coredump collection when wwan device encounters an exception it reboots & stays in fastboot mode for coredump collection by host driver. On detecting exception state driver collects the core dump, creates the devlink region & reports an event to user space application for dump collection. The user space application invokes devlink region read command for dump collection. Below are the devlink commands used for coredump collection. devlink region new pci/$BDF/mr_dump devlink region read pci/$BDF/mr_dump snapshot $ID address $ADD length $LEN devlink region del pci/$BDF/mr_dump snapshot $ID Signed-off-by: M Chetan Kumar <[email protected]> Signed-off-by: Devegowda Chandrashekar <[email protected]> Signed-off-by: Mishra Soumya Prakash <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-08-17net: wwan: t7xx: PCIe reset rescanHaijun Liu8-2/+212
PCI rescan module implements "rescan work queue". In firmware flashing or coredump collection procedure WWAN device is programmed to boot in fastboot mode and a work item is scheduled for removal & detection. The WWAN device is reset using APCI call as part driver removal flow. Work queue rescans pci bus at fixed interval for device detection, later when device is detect work queue exits. Signed-off-by: Haijun Liu <[email protected]> Co-developed-by: Madhusmita Sahu <[email protected]> Signed-off-by: Madhusmita Sahu <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Signed-off-by: M Chetan Kumar <[email protected]> Signed-off-by: Devegowda Chandrashekar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-08-17net: wwan: t7xx: Infrastructure for early port configurationHaijun Liu10-41/+294
To support cases such as FW update or Core dump, the t7xx device is capable of signaling the host that a special port needs to be created before the handshake phase. This patch adds the infrastructure required to create the early ports which also requires a different configuration of CLDMA queues. Signed-off-by: Haijun Liu <[email protected]> Co-developed-by: Madhusmita Sahu <[email protected]> Signed-off-by: Madhusmita Sahu <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Signed-off-by: Devegowda Chandrashekar <[email protected]> Signed-off-by: M Chetan Kumar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-08-17net: wwan: t7xx: Add AP CLDMAHaijun Liu11-28/+125
The t7xx device contains two Cross Layer DMA (CLDMA) interfaces to communicate with AP and Modem processors respectively. So far only MD-CLDMA was being used, this patch enables AP-CLDMA. Rename small Application Processor (sAP) to AP. Signed-off-by: Haijun Liu <[email protected]> Co-developed-by: Madhusmita Sahu <[email protected]> Signed-off-by: Madhusmita Sahu <[email protected]> Signed-off-by: Moises Veleta <[email protected]> Signed-off-by: Devegowda Chandrashekar <[email protected]> Signed-off-by: M Chetan Kumar <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-20wwan: iosm: use a flexible array rather than allocate short objectsJakub Kicinski1-4/+1
GCC array-bounds warns that ipc_coredump_get_list() under-allocates the size of struct iosm_cd_table *cd_table. This is avoidable - we just need a flexible array. Nothing calls sizeof() on struct iosm_cd_list or anything that contains it. Reviewed-by: M Chetan Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-05-20net: wwan: t7xx: use GFP_ATOMIC under spin lock in t7xx_cldma_gpd_set_next_ptr()Yang Yingliang1-5/+5
Sometimes t7xx_cldma_gpd_set_next_ptr() is called under spin lock, so add 'gfp_mask' parameter in t7xx_cldma_gpd_set_next_ptr() to pass the flag. Fixes: 39d439047f1d ("net: wwan: t7xx: Add control DMA interface") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Yang Yingliang <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-05-19net: wwan: iosm: remove pointless null checkJakub Kicinski1-10/+0
GCC 12 warns: drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c: In function ‘ipc_protocol_dl_td_process’: drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c:406:13: warning: the comparison will always evaluate as ‘true’ for the address of ‘cb’ will never be NULL [-Waddress] 406 | if (!IPC_CB(skb)) { | ^ Indeed the check seems entirely pointless. Hopefully the other validation checks will catch if the cb is bad, but it can't be NULL. Reviewed-by: M Chetan Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-05-19net: wwan: t7xx: Fix smatch errorsRicardo Martinez3-6/+3
t7xx_request_irq() error: uninitialized symbol 'ret'. t7xx_core_hk_handler() error: potentially dereferencing uninitialized 'event'. If the condition to enter the loop that waits for the handshake event is false on the first iteration then the uninitialized 'event' will be dereferenced, fix this by initializing 'event' to NULL. t7xx_port_proxy_recv_skb() warn: variable dereferenced before check 'skb'. No need to check skb at t7xx_port_proxy_recv_skb() since we know it is always called with a valid skb by t7xx_cldma_gpd_rx_from_q(). Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-05-16net: wwan: t7xx: Avoid calls to skb_data_area_size()Ricardo Martinez2-8/+5
skb_data_area_size() helper was used to calculate the size of the DMA mapped buffer passed to the HW. Instead of doing this, use the size passed to allocate the skbs. Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
2022-05-16net: wwan: t7xx: Fix return type of t7xx_dl_add_timedout()YueHaibing1-4/+2
t7xx_dl_add_timedout() now return int 'ret', but the return type is bool. Change the return type to int for furthor errcode upstream. Signed-off-by: YueHaibing <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Device deep sleep lock/unlockHaijun Liu6-15/+158
Introduce the mechanism to lock/unlock the device 'deep sleep' mode. When the PCIe link state is L1.2 or L2, the host side still can keep the device is in D0 state from the host side point of view. At the same time, if the device's 'deep sleep' mode is unlocked, the device will go to 'deep sleep' while it is still in D0 state on the host side. Signed-off-by: Haijun Liu <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Runtime PMHaijun Liu4-0/+68
Enables runtime power management callbacks including runtime_suspend and runtime_resume. Autosuspend is used to prevent overhead by frequent wake-ups. Signed-off-by: Haijun Liu <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Eliot Lee <[email protected]> Signed-off-by: Eliot Lee <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Introduce power managementHaijun Liu8-1/+700
Implements suspend, resumes, freeze, thaw, poweroff, and restore `dev_pm_ops` callbacks. From the host point of view, the t7xx driver is one entity. But, the device has several modules that need to be addressed in different ways during power management (PM) flows. The driver uses the term 'PM entities' to refer to the 2 DPMA and 2 CLDMA HW blocks that need to be managed during PM flows. When a dev_pm_ops function is called, the PM entities list is iterated and the matching function is called for each entry in the list. Signed-off-by: Haijun Liu <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Add WWAN network interfaceHaijun Liu4-1/+489
Creates the Cross Core Modem Network Interface (CCMNI) which implements the wwan_ops for registration with the WWAN framework, CCMNI also implements the net_device_ops functions used by the network device. Network device operations include open, close, start transmission, TX timeout and change MTU. Signed-off-by: Haijun Liu <[email protected]> Co-developed-by: Chandrashekar Devegowda <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Add data path interfaceHaijun Liu7-0/+2758
Data Path Modem AP Interface (DPMAIF) HIF layer provides methods for initialization, ISR, control and event handling of TX/RX flows. DPMAIF TX Exposes the 'dmpaif_tx_send_skb' function which can be used by the network device to transmit packets. The uplink data management uses a Descriptor Ring Buffer (DRB). First DRB entry is a message type that will be followed by 1 or more normal DRB entries. Message type DRB will hold the skb information and each normal DRB entry holds a pointer to the skb payload. DPMAIF RX The downlink buffer management uses Buffer Address Table (BAT) and Packet Information Table (PIT) rings. The BAT ring holds the address of skb data buffer for the HW to use, while the PIT contains metadata about a whole network packet including a reference to the BAT entry holding the data buffer address. The driver reads the PIT and BAT entries written by the modem, when reaching a threshold, the driver will reload the PIT and BAT rings. Signed-off-by: Haijun Liu <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Data path HW layerHaijun Liu3-0/+1675
Data Path Modem AP Interface (DPMAIF) HW layer provides HW abstraction for the upper layer (DPMAIF HIF). It implements functions to do the HW configuration, TX/RX control and interrupt handling. Signed-off-by: Haijun Liu <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Add AT and MBIM WWAN portsChandrashekar Devegowda4-0/+198
Adds AT and MBIM ports to the port proxy infrastructure. The initialization method is responsible for creating the corresponding ports using the WWAN framework infrastructure. The implemented WWAN port operations are start, stop, and TX. Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Add control portHaijun Liu9-3/+561
Control Port implements driver control messages such as modem-host handshaking, controls port enumeration, and handles exception messages. The handshaking process between the driver and the modem happens during the init sequence. The process involves the exchange of a list of supported runtime features to make sure that modem and host are ready to provide proper feature lists including port enumeration. Further features can be enabled and controlled in this handshaking process. Signed-off-by: Haijun Liu <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Add port proxy infrastructureHaijun Liu7-2/+677
Port-proxy provides a common interface to interact with different types of ports. Ports export their configuration via `struct t7xx_port` and operate as defined by `struct port_ops`. Signed-off-by: Haijun Liu <[email protected]> Co-developed-by: Chandrashekar Devegowda <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Add core componentsHaijun Liu14-0/+2108
Registers the t7xx device driver with the kernel. Setup all the core components: PCIe layer, Modem Host Cross Core Interface (MHCCIF), modem control operations, modem state machine, and build infrastructure. * PCIe layer code implements driver probe and removal. * MHCCIF provides interrupt channels to communicate events such as handshake, PM and port enumeration. * Modem control implements the entry point for modem init, reset and exit. * The modem status monitor is a state machine used by modem control to complete initialization and stop. It is used also to propagate exception events reported by other components. Signed-off-by: Haijun Liu <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-05-09net: wwan: t7xx: Add control DMA interfaceHaijun Liu5-0/+1812
Cross Layer DMA (CLDMA) Hardware interface (HIF) enables the control path of Host-Modem data transfers. CLDMA HIF layer provides a common interface to the Port Layer. CLDMA manages 8 independent RX/TX physical channels with data flow control in HW queues. CLDMA uses ring buffers of General Packet Descriptors (GPD) for TX/RX. GPDs can represent multiple or single data buffers (DB). CLDMA HIF initializes GPD rings, registers ISR handlers for CLDMA interrupts, and initializes CLDMA HW registers. CLDMA TX flow: 1. Port Layer write 2. Get DB address 3. Configure GPD 4. Triggering processing via HW register write CLDMA RX flow: 1. CLDMA HW sends a RX "done" to host 2. Driver starts thread to safely read GPD 3. DB is sent to Port layer 4. Create a new buffer for GPD ring Note: This patch does not enable compilation since it has dependencies such as t7xx_pcie_mac_clear_int()/t7xx_pcie_mac_set_int() and struct t7xx_pci_dev which are added by the core patch. Signed-off-by: Haijun Liu <[email protected]> Signed-off-by: Chandrashekar Devegowda <[email protected]> Co-developed-by: Ricardo Martinez <[email protected]> Signed-off-by: Ricardo Martinez <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-04-25wwan_hwsim: Avoid flush_scheduled_work() usageTetsuo Handa1-5/+17
Flushing system-wide workqueues is dangerous and will be forbidden. Replace system_wq with local wwan_wq. While we are at it, make err_clean_devs: label of wwan_hwsim_init() behave like wwan_hwsim_exit(), for it is theoretically possible to call wwan_hwsim_debugfs_devcreate_write()/wwan_hwsim_debugfs_devdestroy_write() by the moment wwan_hwsim_init_devs() returns. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Tetsuo Handa <[email protected]> Reviewed-by: Sergey Ryazanov <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2022-03-23Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-1/+1
Merge in overtime fixes, no conflicts. Signed-off-by: Jakub Kicinski <[email protected]>
2022-03-22net: wwan: qcom_bam_dmux: fix wrong pointer passed to IS_ERR()Yang Yingliang1-1/+1
It should check dmux->tx after calling dma_request_chan(). Fixes: 21a0ffd9b38c ("net: wwan: Add Qualcomm BAM-DMUX WWAN network driver") Signed-off-by: Yang Yingliang <[email protected]> Reviewed-by: Stephan Gerhold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2022-02-14net: wwan: iosm: drop debugfs dev referenceM Chetan Kumar2-2/+5
Post debugfs use call wwan_put_debugfs_dir()to drop debugfs dev reference. Signed-off-by: M Chetan Kumar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-02-14net: wwan: debugfs obtained dev reference not droppedM Chetan Kumar1-0/+36
WWAN driver call's wwan_get_debugfs_dir() to obtain WWAN debugfs dir entry. As part of this procedure it returns a reference to a found device. Since there is no debugfs interface available at WWAN subsystem, it is not possible to drop dev reference post debugfs use. This leads to side effects like post wwan driver load and reload the wwan instance gets increment from wwanX to wwanX+1. A new debugfs interface is added in wwan subsystem so that wwan driver can drop the obtained dev reference post debugfs use. void wwan_put_debugfs_dir(struct dentry *dir) Signed-off-by: M Chetan Kumar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-02-13net: wwan: iosm: Enable M.2 7360 WWAN card supportM Chetan Kumar10-78/+1033
This patch enables Intel M.2 7360 WWAN card support on IOSM Driver. Control path implementation is a reuse whereas data path implementation it uses a different protocol called as MUX Aggregation. The major portion of this patch covers the MUX Aggregation protocol implementation used for IP traffic communication. For M.2 7360 WWAN card, driver exposes 2 wwan AT ports for control communication. The user space application or the modem manager to use wwan AT port for data path establishment. During probe, driver reads the mux protocol device capability register to know the mux protocol version supported by device. Base on which the right mux protocol is initialized for data path communication. An overview of an Aggregation Protocol 1> An IP packet is encapsulated with 16 octet padding header to form a Datagram & the start offset of the Datagram is indexed into Datagram Header (DH). 2> Multiple such Datagrams are composed & the start offset of each DH is indexed into Datagram Table Header (DTH). 3> The Datagram Table (DT) is IP session specific & table_length item in DTH holds the number of composed datagram pertaining to that particular IP session. 4> And finally the offset of first DTH is indexed into DBH (Datagram Block Header). So in TX/RX flow Datagram Block (Datagram Block Header + Payload)is exchanged between driver & device. Signed-off-by: M Chetan Kumar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-01-15net: wwan: Fix MRU mismatch issue which may lead to data connection lostSlark Xiao1-2/+2
In pci_generic.c there is a 'mru_default' in struct mhi_pci_dev_info. This value shall be used for whole mhi if it's given a value for a specific product. But in function mhi_net_rx_refill_work(), it's still using hard code value MHI_DEFAULT_MRU. 'mru_default' shall have higher priority than MHI_DEFAULT_MRU. And after checking, this change could help fix a data connection lost issue. Fixes: 5c2c85315948 ("bus: mhi: pci-generic: configurable network interface MRU") Signed-off-by: Shujun Wang <[email protected]> Signed-off-by: Slark Xiao <[email protected]> Reviewed-by: Loic Poulain <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2022-01-04Revert "net: wwan: iosm: Keep device at D0 for s2idle case"M Chetan Kumar1-3/+0
Depending on BIOS configuration IOSM driver exchanges protocol required for putting device into D3L2 or D3L1.2. ipc_pcie_suspend_s2idle() is implemented to put device to D3L1.2. This patch forces PCI core know this device should stay at D0. - pci_save_state()is expensive since it does a lot of slow PCI config reads. The reported issue is not observed on x86 platform. The supurios wake on AMD platform needs to be futher debugged with orignal patch submitter [1]. Also the impact of adding pci_save_state() needs to be assessed by testing it on other platforms. This reverts commit f4dd5174e273("net: wwan: iosm: Keep device at D0 for s2idle case"). [1] https://lore.kernel.org/all/[email protected]/ Signed-off-by: M Chetan Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2021-12-27net: wwan: iosm: Keep device at D0 for s2idle caseKai-Heng Feng1-0/+3
We are seeing spurious wakeup caused by Intel 7560 WWAN on AMD laptops. This prevent those laptops to stay in s2idle state. >From what I can understand, the intention of ipc_pcie_suspend() is to put the device to D3cold, and ipc_pcie_suspend_s2idle() is to keep the device at D0. However, the device can still be put to D3hot/D3cold by PCI core. So explicitly let PCI core know this device should stay at D0, to solve the spurious wakeup. Signed-off-by: Kai-Heng Feng <[email protected]> Signed-off-by: David S. Miller <[email protected]>