[GIT] [4.15] NFC update
Hi David, This is the NFC pull request for 4.15. We have: - A new netlink command for explicitly deactivating NFC targets - i2c constification for all NFC drivers - One NFC device allocation error path fix The following changes since commit 2798b80b385384d51a81832556ee9ad25d175f9b: Merge branch 'eBPF-based-device-cgroup-controller' (2017-11-05 23:26:51 +0900) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.15-1 for you to fetch changes up to 4d63adfe12dd9cb61ed8badb4d798955399048c2: NFC: Add NFC_CMD_DEACTIVATE_TARGET support (2017-11-10 00:03:39 +0100) Allen Pais (1): NFC: Convert timers to use timer_setup() Arvind Yadav (8): nfc: microread: constify i2c_device_id nfc: nfcmrvl: constify i2c_device_id nfc: nxp-nci: constify i2c_device_id nfc: pn533: constify i2c_device_id nfc: pn544: constify i2c_device_id nfc: s3fwrn5: constify i2c_device_id nfc: st-nci: constify i2c_device_id nfc: st21nfca: constify i2c_device_id Colin Ian King (2): nfc: s3fwrn5: make array match static const NFC: fdp: make struct nci_ops static Johan Hovold (1): NFC: fix device-allocation error return Mark Greer (2): NFC: digital: Abort cmd when deactivating target NFC: Add NFC_CMD_DEACTIVATE_TARGET support drivers/nfc/fdp/fdp.c | 2 +- drivers/nfc/microread/i2c.c| 2 +- drivers/nfc/nfcmrvl/i2c.c | 2 +- drivers/nfc/nxp-nci/i2c.c | 2 +- drivers/nfc/pn533/i2c.c| 2 +- drivers/nfc/pn544/i2c.c| 2 +- drivers/nfc/s3fwrn5/firmware.c | 2 +- drivers/nfc/s3fwrn5/i2c.c | 2 +- drivers/nfc/st-nci/i2c.c | 2 +- drivers/nfc/st21nfca/i2c.c | 2 +- include/uapi/linux/nfc.h | 2 ++ net/nfc/core.c | 10 -- net/nfc/digital_core.c | 1 + net/nfc/hci/core.c | 7 +++ net/nfc/hci/llc_shdlc.c| 23 +-- net/nfc/llcp_core.c| 14 ++ net/nfc/netlink.c | 29 + 17 files changed, 64 insertions(+), 42 deletions(-)
Re: [PATCH] NFC: fix device-allocation error return
Hi Johan, On Sun, Jul 09, 2017 at 01:08:58PM +0200, Johan Hovold wrote: > A recent change fixing NFC device allocation itself introduced an > error-handling bug by returning an error pointer in case device-id > allocation failed. This is clearly broken as the callers still expected > NULL to be returned on errors as detected by Dan's static checker. > > Fix this up by returning NULL in the event that we've run out of memory > when allocating a new device id. > > Note that the offending commit is marked for stable (3.8) so this fix > needs to be backported along with it. > > Fixes: 20777bc57c34 ("NFC: fix broken device allocation") > Cc: stable# 3.8 > Reported-by: Dan Carpenter > Signed-off-by: Johan Hovold > --- > net/nfc/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, thanks for the fix. Cheers, Samuel.
[GIT] [4.13] NFC update
Hi David, This is the NFC pull request for 4.13. We have: - A conversion to unified device and GPIO APIs for the fdp, pn544, and st{21,-nci} drivers. - A fix for NFC device IDs allocation. - A fix for the nfcmrvl driver firmware download mechanism. - A trf7970a DT and GPIO cleanup and clock setting fix. - A few fixes for potential overflows in the digital and LLCP code. The following changes since commit 06d4d450db770a70b29fa0244d50390c85e7e3c7: net: dsa: Fix legacy probing (2017-06-17 22:59:45 -0400) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.13-1 for you to fetch changes up to bd751808f9ff5e1822c627f6c4283009e66b2e53: NFC: trf7970a: Correct register settings for 27MHz clock (2017-06-28 09:16:54 +0200) Andy Shevchenko (13): NFC: pn544: Switch to devm_acpi_dev_add_driver_gpios() NFC: st21nfca: Add GPIO ACPI mapping table NFC: st21nfca: Get rid of code duplication in ->probe() NFC: fdp: Convert I2C driver to ->probe_new() NFC: fdp: Convert to use devres API NFC: fdp: Add GPIO ACPI mapping table NFC: st-nci: Get rid of platform data NFC: st-nci: Get rid of "interesting" use of interrupt polarity NFC: st-nci: Covert to use GPIO descriptor NFC: st-nci: Use unified device properties API meaningfully NFC: st-nci: Add GPIO ACPI mapping table NFC: st-nci: Get rid of code duplication in ->probe() MAINTAINERS: Remove non-existing NFC platform data files Colin Ian King (1): NFC: trf7970a: fix check of clock frequencies, use && instead of || Geoff Lansberry (1): NFC: trf7970a: Correct register settings for 27MHz clock Gustavo A. R. Silva (2): nfc: nci: remove unnecessary null check NFC: add NULL checks to avoid potential NULL pointer dereference Johan Hovold (8): NFC: fix broken device allocation NFC: nfcmrvl_uart: add missing tty-device sanity check NFC: nfcmrvl: do not use device-managed resources NFC: nfcmrvl: use nfc-device for firmware download NFC: nfcmrvl: fix firmware-management initialisation NFC: nfcmrvl_uart: fix device-node leak during probe NFC: nfcmrvl_usb: use interface as phy device NFC: nfcmrvl: allow gpio 0 for reset signalling Mark Greer (12): MAINTAINERS: NFC: trf7970a: Add Mark Greer as maintainer NFC: trf7970a: Don't de-assert EN2 unless it was asserted NFC: trf7970a: Fix inaccurate comment in trf7970a_probe() NFC: trf7970a: Only check 'en2-rf-quirk' if EN2 is specified NFC: trf7970a: Remove useless comment NFC: trf7970a: Remove support for 'vin-voltage-override' DT property NFC: trf7970a: Enable pins are active high not active low NFC: trf7970a: Convert to descriptor based GPIO interface NFC: trf7970a: Clean up coding style issues NFC: digital: NFC-A SEL_RES must be one byte NFC: digital: NFC-DEP Target WT(nfcdep,max) is now 14 Revert "NFC: trf7970a: Handle extra byte in response to Type 5 RMB commands" Markus Elfring (2): NFC: digital: Improve a size determination in four functions NFC: digital: Delete an error message for memory allocation failure Mateusz Jurczyk (3): nfc: Fix the sockaddr length sanitization in llcp_sock_connect nfc: Ensure presence of required attributes in the activate_target handler NFC: Add sockaddr length checks before accessing sa_family in bind handlers .../devicetree/bindings/net/nfc/trf7970a.txt | 10 +- MAINTAINERS| 11 +- drivers/nfc/Kconfig| 2 +- drivers/nfc/fdp/fdp.c | 15 +- drivers/nfc/fdp/i2c.c | 38 +- drivers/nfc/nfcmrvl/fw_dnld.c | 7 +- drivers/nfc/nfcmrvl/main.c | 40 ++- drivers/nfc/nfcmrvl/uart.c | 11 +- drivers/nfc/nfcmrvl/usb.c | 4 +- drivers/nfc/nfcsim.c | 6 +- drivers/nfc/pn544/i2c.c| 3 +- drivers/nfc/st-nci/i2c.c | 164 ++--- drivers/nfc/st-nci/spi.c | 162 ++--- drivers/nfc/st21nfca/i2c.c | 62 +--- drivers/nfc/trf7970a.c | 391 ++--- include/linux/platform_data/nfcmrvl.h | 2 +- include/linux/platform_data/st-nci.h | 31 -- net/nfc/core.c | 31 +- net/nfc/digital_core.c | 12 +- net/nfc/digital_dep.c | 2 +- net/nfc/digital_technology.c | 3 +- net/nfc/llcp_sock.c| 9 +- net/nfc/nci/core.c
Re: [PATCH] nfc: Add sockaddr length checks before accessing sa_family in bind handlers
On Tue, Jun 13, 2017 at 06:44:28PM +0200, Mateusz Jurczyk wrote: > Verify that the caller-provided sockaddr structure is large enough to > contain the sa_family field, before accessing it in bind() handlers of the > AF_NFC socket. Since the syscall doesn't enforce a minimum size of the > corresponding memory region, very short sockaddrs (zero or one byte long) > result in operating on uninitialized memory while referencing .sa_family. > > Signed-off-by: Mateusz Jurczyk> --- > net/nfc/llcp_sock.c | 6 -- > 1 file changed, 4 insertions(+), 2 deletions(-) Applied to nfc-next, thanks. Cheers, Samuel.
Re: [PATCH] nfc: nci: remove unnecessary null check
Hi Gustavo, On Tue, Jun 13, 2017 at 11:37:18AM -0500, Gustavo A. R. Silva wrote: > Remove unnecessary NULL check for pointer conn_info. > conn_info is set in list_for_each_entry() using container_of(), > which is never NULL. > > Addresses-Coverity-ID: 1362349 > Cc: Guenter Roeck> Signed-off-by: Gustavo A. R. Silva > --- > net/nfc/nci/core.c | 9 - > 1 file changed, 4 insertions(+), 5 deletions(-) Applied to nfc-next, thanks. Cheers, Samuel.
Re: [PATCH] nfc: Ensure presence of required attributes in the activate_target netlink handler
Hi Mateusz, On Wed, May 24, 2017 at 12:42:26PM +0200, Mateusz Jurczyk wrote: > Check that the NFC_ATTR_TARGET_INDEX and NFC_ATTR_PROTOCOLS attributes (in > addition to NFC_ATTR_DEVICE_INDEX) are provided by the netlink client > prior to accessing them. This prevents potential unhandled NULL pointer > dereference exceptions which can be triggered by malicious user-mode > programs, if they omit one or both of these attributes. > > Signed-off-by: Mateusz Jurczyk> --- > net/nfc/netlink.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Applied, thanks. Cheers, Samuel.
Re: [PATCH] nfc: Fix the sockaddr length sanitization in llcp_sock_connect
Hi Mateusz, On Wed, May 24, 2017 at 12:26:20PM +0200, Mateusz Jurczyk wrote: > Fix the sockaddr length verification in the connect() handler of NFC/LLCP > sockets, to compare against the size of the actual structure expected on > input (sockaddr_nfc_llcp) instead of its shorter version (sockaddr_nfc). > > Both structures are defined in include/uapi/linux/nfc.h. The fields > specific to the _llcp extended struct are as follows: > >276__u8 dsap; /* Destination SAP, if known */ >277__u8 ssap; /* Source SAP to be bound to */ >278char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* > Service name URI */; >279size_t service_name_len; > > If the caller doesn't provide a sufficiently long sockaddr buffer, these > fields remain uninitialized (and they currently originate from the stack > frame of the top-level sys_connect handler). They are then copied by > llcp_sock_connect() into internal storage (nfc_llcp_sock structure), and > could be subsequently read back through the user-mode getsockname() > function (handled by llcp_sock_getname()). This would result in the > disclosure of up to ~70 uninitialized bytes from the kernel stack to > user-mode clients capable of creating AFC_NFC sockets. > > Signed-off-by: Mateusz Jurczyk> --- > net/nfc/llcp_sock.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Applied to nfc-next, thanks. Cheers, Samuel.
Re: [PATCH 0/2] NFC-digital: Adjustments for four function implementations
Hi Markus, On Mon, May 22, 2017 at 02:57:42PM +0200, SF Markus Elfring wrote: > From: Markus Elfring> Date: Mon, 22 May 2017 14:50:05 +0200 > > Two update suggestions were taken into account > from static source code analysis. > > Markus Elfring (2): > Improve a size determination in four functions > Delete an error message for a failed memory allocation in digital_in_send() Both patches applied to nfc-next, thanks. Cheers, Samuel.
Re: [PATCH v2 0/8] NFC: fix device allocation and nfcmrvl crashes
Hi Johan, On Thu, Mar 30, 2017 at 12:15:34PM +0200, Johan Hovold wrote: > This started out with the observation that the nfcmrvl_uart driver > unconditionally dereferenced the tty class device despite the fact that > not every tty has an associated struct device (Unix98 ptys). Some > further changes were needed in the common nfcmrvl code to fully address > this, some of which also incidentally fixed a few related bugs (e.g. > resource leaks in error paths). > > While fixing this I stumbled over a regression in NFC core that lead to > broken registration error paths and misnamed workqueues. > > Note that this has only been tested by configuring the n_hci line > discipline for different ttys without any actual NFC hardware connected. > > Johan > > > Changes in v2 > - fix typo in commit message (1/8) > - release reset gpio in error paths (3/8) > - fix description of patch impact (3/8) > - allow gpio 0 to be used for reset signalling (8/8, new) > > > Johan Hovold (8): > NFC: fix broken device allocation > NFC: nfcmrvl_uart: add missing tty-device sanity check > NFC: nfcmrvl: do not use device-managed resources > NFC: nfcmrvl: use nfc-device for firmware download > NFC: nfcmrvl: fix firmware-management initialisation > NFC: nfcmrvl_uart: fix device-node leak during probe > NFC: nfcmrvl_usb: use interface as phy device > NFC: nfcmrvl: allow gpio 0 for reset signalling Applied, thanks. Cheers, Samuel.
[GIT] [4.12] NFC update
Hi David, This is the NFC pull request for 4.12. We have: - Improvements for the pn533 command queue handling and device registration order. - Removal of platform data for the pn544 and st21nfca drivers. - Additional device tree options to support more trf7970a hardware options. - Support for Sony's RC-S380P through the port100 driver. - Removal of the obsolte nfcwilink driver. - Headers inclusion cleanups (miscdevice.h, unaligned.h) for many drivers. The following changes since commit eefe06e8ceea88f8397a8df0880ab5ca28dcada6: Merge branch 'bpf-prog-testing-framework' (2017-04-01 12:45:58 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.12-1 for you to fetch changes up to 4ea206395d3aede32bab94a75ec573530486fa44: nfc: fix get_unaligned_...() misuses (2017-04-17 00:42:22 +0200) NFC 4.12 pull request This is the NFC pull request for 4.12. We have: - Improvements for the pn533 command queue handling and device registration order. - Removal of platform data for the pn544 and st21nfca drivers. - Additional device tree options to support more trf7970a hardware options. - Support for Sony's RC-S380P through the port100 driver. - Removal of the obsolte nfcwilink driver. - Headers inclusion cleanups (miscdevice.h, unaligned.h) for many drivers. Al Viro (1): nfc: fix get_unaligned_...() misuses Andrey Rusalin (3): NFC: pn533: change order of free_irq and dev unregistration NFC: pn533: improve cmd queue handling NFC: pn533: change order operations in dev registation Andy Shevchenko (12): NFC: pn544: Get rid of platform data NFC: pn544: Convert to use GPIO descriptor NFC: pn544: Convert to use devm_request_threaded_irq() NFC: pn544: Add GPIO ACPI mapping table NFC: pn544: Get rid of code duplication in ->probe() NFC: st21nfca: Fix obvious typo when check error code NFC: st21nfca: Get rid of platform data NFC: st21nfca: Get rid of "interesting" use of interrupt polarity NFC: st21nfca: Covert to use GPIO descriptor NFC: st21nfca: Use unified device property API meaningfully NFC: netlink: Use error code from nfc_activate_target() NFC: Add nfc_dbg() macro Christophe JAILLET (1): NFC: st21nfca: Fix potential memory leak Corentin Labbe (3): nfc: nxp-nci: Remove unneeded linux/miscdevice.h include nfc: pn544: Remove unneeded linux/miscdevice.h include nfc: st21nfca: Remove unneeded linux/miscdevice.h include Dan Carpenter (1): NFC: nfcmrvl: double free on error path Geliang Tang (1): NFC: nfcmrvl: drop duplicate header gpio.h Geoff Lansberry (2): NFC: trf7970a: add device tree option for 27MHz clock NFC: trf7970a: Add device tree option of 1.8 Volt IO voltage Guan Ben (1): NFC: Make EN2 pin optional in the TRF7970A driver Guenter Roeck (1): NFC: nxp-nci: Include unaligned.h instead of access_ok.h Michał Mirosław (1): NFC: pn533: use constant off-stack buffer for sending acks Nicholas Mc Guire (1): nfc: nxp-nci: use msleep for long delays OGAWA Hirofumi (4): nfc: Add support RC-S380P to port100 nfc: Send same info for both of NFC_CMD_GET_DEVICE and NFC_EVENT_DEVICE_ADDED nfc: Fix RC-S380* needs zero-length packet nfc: Fix hangup of RC-S380* in port100_send_ack() Rob Herring (1): NFC: remove TI nfcwilink driver Samuel Ortiz (1): MAINTAINERS: Remove Lauro and Aloisio from the NFC maintainers list Sudip Mukherjee (1): nfc: fdp: fix NULL pointer dereference Tobias Klauser (1): NFC: nfcmrvl: Include unaligned.h instead of access_ok.h .../devicetree/bindings/net/nfc/trf7970a.txt | 8 +- MAINTAINERS| 2 - drivers/nfc/Kconfig| 11 - drivers/nfc/Makefile | 1 - drivers/nfc/fdp/i2c.c | 6 +- drivers/nfc/nfcmrvl/fw_dnld.c | 7 +- drivers/nfc/nfcmrvl/spi.c | 6 +- drivers/nfc/nfcwilink.c| 578 - drivers/nfc/nxp-nci/firmware.c | 2 +- drivers/nfc/nxp-nci/i2c.c | 7 +- drivers/nfc/pn533/i2c.c| 34 +- drivers/nfc/pn533/pn533.c | 82 +-- drivers/nfc/pn533/pn533.h | 1 + drivers/nfc/pn533/usb.c| 8 +- drivers/nfc/pn544/i2c.c| 221 ++-- drivers/nfc/port100.c | 44 +- drivers/nfc/st21nfca/core.c| 12 +- drivers/nfc/st21nfca/i2c.c | 123 + drivers/n
Re: [PATCH v2 0/8] NFC: fix device allocation and nfcmrvl crashes
Hi Johan, On Tue, Apr 18, 2017 at 12:09:16PM +0200, Johan Hovold wrote: > On Thu, Mar 30, 2017 at 12:15:34PM +0200, Johan Hovold wrote: > > This started out with the observation that the nfcmrvl_uart driver > > unconditionally dereferenced the tty class device despite the fact that > > not every tty has an associated struct device (Unix98 ptys). Some > > further changes were needed in the common nfcmrvl code to fully address > > this, some of which also incidentally fixed a few related bugs (e.g. > > resource leaks in error paths). > > > > While fixing this I stumbled over a regression in NFC core that lead to > > broken registration error paths and misnamed workqueues. > > > > Note that this has only been tested by configuring the n_hci line > > discipline for different ttys without any actual NFC hardware connected. > > > Johan Hovold (8): > > NFC: fix broken device allocation > > NFC: nfcmrvl_uart: add missing tty-device sanity check > > NFC: nfcmrvl: do not use device-managed resources > > NFC: nfcmrvl: use nfc-device for firmware download > > NFC: nfcmrvl: fix firmware-management initialisation > > NFC: nfcmrvl_uart: fix device-node leak during probe > > NFC: nfcmrvl_usb: use interface as phy device > > NFC: nfcmrvl: allow gpio 0 for reset signalling > > Any chance of getting these into 4.12, Samuel? I have yours and Mark Greer patchset pending. I'll push them to nfc-next and see if I can send another pull request to Dave by the end of this week. Cheers, Samuel.
Re: [PATCH v3 1/3] NFC: trf7970a: add device tree option for 27MHz clock
Hi Geoff, On Wed, Dec 21, 2016 at 11:18:32PM -0500, Geoff Lansberry wrote: > The TRF7970A has configuration options to support hardware designs > which use a 27.12MHz clock. This commit adds a device tree option > 'clock-frequency' to support configuring the this chip for default > 13.56MHz clock or the optional 27.12MHz clock. > > Signed-off-by: Geoff Lansberry> --- > .../devicetree/bindings/net/nfc/trf7970a.txt | 2 + > drivers/nfc/trf7970a.c | 50 > +- > 2 files changed, 41 insertions(+), 11 deletions(-) Patches #1 and #2 applied to nfc-next. I'll wait for you to rework #3 before merging. Cheers, Samuel.
Re: [PATCH v1] NFC: netlink: Use error code from nfc_activate_target()
Hi Andy, On Wed, Mar 22, 2017 at 09:20:58PM +0200, Andy Shevchenko wrote: > It looks like a typo to assign a return code to a variable which is not > used. Found due to a compiler warning: > > net/nfc/netlink.c: In function ‘nfc_genl_activate_target’: > net/nfc/netlink.c:903:6: warning: variable ‘rc’ set but not used > [-Wunused-but-set-variable] > int rc; > ^~ > > Signed-off-by: Andy Shevchenko> --- > net/nfc/netlink.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, thanks. Cheers, Samuel.
Re: [PATCH v1] NFC: Add nfc_dbg() macro
On Wed, Mar 22, 2017 at 09:22:51PM +0200, Andy Shevchenko wrote: > In some cases nfc_dbg() is useful. Add such macro to a header. > > Signed-off-by: Andy Shevchenko> --- > include/net/nfc/nfc.h | 1 + > 1 file changed, 1 insertion(+) Applied as well. Cheers, Samuel.
Re: [PATCH] Make EN2 pin optional in the TRF7970A driver
Hi Heiko, On Tue, Feb 07, 2017 at 06:22:04AM +0100, Heiko Schocher wrote: > From: Guan Ben> > Make the EN2 pin optional. This is useful for boards, > which have this pin fix wired, for example to ground. > > Signed-off-by: Guan Ben > Signed-off-by: Mark Jonas > Signed-off-by: Heiko Schocher > > --- > > .../devicetree/bindings/net/nfc/trf7970a.txt | 4 ++-- > drivers/nfc/trf7970a.c | 26 > -- > 2 files changed, 16 insertions(+), 14 deletions(-) Applied to nfc-next, thanks. Cheers, Samuel.
[GIT] [4.8] NFC update
Hi David, This is the first NFC pull request for 4.8. We have: - A fairly large NFC digital stack patchset: * RTOX fixes. * Proper DEP RWT support. * ACK and NACK PDUs handling fixes, in both initiator and target modes. * A few memory leak fixes. - A conversion of the nfcsim driver to use the digital stack. The driver supports the DEP protocol in both NFC-A and NFC-F. - Error injection through debugfs for the nfcsim driver. - Improvements to the port100 driver for the Sony USB chipset, in particular to the command abort and cancellation code paths. - A few minor fixes for the pn533, trf7970a and fdp drivers. The following changes since commit 8186f6e382d8719d0a4bc0ef218c4dd7cf55b496: net-next: mediatek: fix compile error inside mtk_poll_controller() (2016-07-02 15:22:29 -0400) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.8-1 for you to fetch changes up to 2a0fe4fe5bf2a6e2277354e7e8f369a20d881891: NFC: nfcsim: Simulate lost frames through debugfs entry (2016-07-19 23:24:49 +0200) Colin Ian King (1): NFC: set info->ram_patch to NULL when it is released Dan Carpenter (1): NFC: pn533: double free on error in probe() Denys Vlasenko (1): NFC: hci: delete unused nfc_llc_get_rx_head_tail_room() Geert Uytterhoeven (1): NFC: fdp: Detect errors from fdp_nci_create_conn() Geoff Lansberry (1): NFC: trf7970a: add TI recommended write of zero to Register 0x18 Thierry Escande (26): NFC: port100: Explicitly set NFC-F framing for NFC-DEP NFC: digital: Add a delay between poll cycles NFC: llcp: Use dynamic debug for hex dump NFC: nfcsim: Make use of the Digital layer NFC: llcp: Fix usage of llcp_add_tlv() NFC: llcp: Fix 2 memory leaks NFC: port100: Don't send a new command if one is still pending NFC: port100: Fix the command cancellation process NFC: port100: Make port100_abort_cmd() synchronous NFC: port100: Abort current command before switching RF off NFC: nfcsim: Fix missing dependency on NFC_DIGITAL NFC: digital: Fix a memory leak in NFC-F listening mode NFC: digital: Rework error handling in DEP_RES response NFC: digital: Call pending command callbacks at device unregister NFC: digital: Set the command pending flag NFC: digital: Abort last command when dep link goes down NFC: digital: Fix handling of saved PDU sk_buff pointers NFC: digital: Remove useless call to skb_reserve() NFC: digital: Fix target DEP_REQ I-PDU handling after ATN PDU NFC: digital: Fix ACK & NACK PDUs handling in target mode NFC: digital: Rework ACK PDU handling in initiator mode NFC: digital: Free supervisor PDUs NFC: digital: Add support for NFC DEP Response Waiting Time NFC: digital: Fix RTOX supervisor PDU handling NFC: nfcsim: Add support for sysfs control entry NFC: nfcsim: Simulate lost frames through debugfs entry drivers/nfc/Kconfig | 1 + drivers/nfc/fdp/fdp.c| 6 +- drivers/nfc/nfcsim.c | 643 --- drivers/nfc/pn533/usb.c | 9 +- drivers/nfc/port100.c| 82 +- drivers/nfc/trf7970a.c | 4 + include/net/nfc/digital.h| 4 +- include/net/nfc/llc.h| 4 - net/nfc/digital_core.c | 28 +- net/nfc/digital_dep.c| 316 ++--- net/nfc/digital_technology.c | 11 +- net/nfc/hci/llc.c| 17 +- net/nfc/llcp_commands.c | 23 +- net/nfc/llcp_core.c | 9 +- 14 files changed, 648 insertions(+), 509 deletions(-)
Re: [PATCH] nfp: check idx is -ENOSPC before using it is an index
Hi Colin, On Mon, Jul 11, 2016 at 04:46:57PM +0100, Colin King wrote: > diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c > index e44a7a2..d93d314 100644 > --- a/drivers/nfc/fdp/fdp.c > +++ b/drivers/nfc/fdp/fdp.c > @@ -345,7 +345,7 @@ static void fdp_nci_release_firmware(struct nci_dev *ndev) > > if (info->ram_patch) { > release_firmware(info->ram_patch); > - info->otp_patch = NULL; > + info->ram_patch = NULL; > } > } This chunk is unrelated and also already applied to my nfc-next tree. Cheers, Samuel.
[GIT] [4.6] NFC update
Hi David, This is the first NFC pull request for 4.7. With this one we mainly have: - Support for NXP's pn532 NFC chipset. The pn532 is based on the same microcontroller as the pn533, but it talks to the host through i2c instead of USB. By separating the pn533 driver into core and PHY parts, we can not add the i2c layer and support the pn532 chipset. - Support for NCI's loopback mode. This is a testing mode where each packet received by the NFCC is sent back to the DH, allowing the host to test that the controller can receive and send data. - A few ACPI related fixes for the STMicro drivers, in order to match the device tree naming scheme. - A bunch of cleanups for the st-nci and the st21nfca STMicro drivers. The following changes since commit 03c5b534185f9844c1b5fcfdbae2adc32821ec42: ipv6: fix inet6_lookup_listener() (2016-04-09 16:53:52 -0400) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.7-1 for you to fetch changes up to b31d5103c33280738188c51e226224dff4401c7b: NFC: pn533: handle interrupted commands in pn533_recv_frame (2016-05-10 00:01:47 +0200) Christophe Ricard (20): nfc: st21nfca: Fix static checker warning nfc: st-nci: i2c: Change ST_NCI_GPIO_NAME_RESET to match DT nfc: st-nci: spi: Change ST_NCI_GPIO_NAME_RESET to match DT nfc: st21nfca: i2c: Change ST21NFCA_GPIO_NAME_RESET to match DT nfc: st21nfca: set is_ese_present and is_uicc_present properly nfc: st-nci: set is_ese_present and is_uicc_present properly nfc: st21nfca: Simplify white list building nfc: st-nci: Simplify white list building nfc: st-nci: A APDU_READER_GATE pipe is unexpected on a UICC nfc: st21nfca: A APDU_READER_GATE pipe is unexpected on a UICC NFC: st21nfca: Drop two useless checks in ACPI probe path NFC: st-nci: i2c: Drop two useless checks in ACPI probe path NFC: st-nci: spi: Drop two useless checks in ACPI probe path nfc: st-nci: Remove redundant ST_NCI_HCI_HOST_ID_ESE from st-nci.h nfc: st21nfca: Remove duplicated ST21NFCA_ESE_HOST_ID from se.c nfc: nci: Fix nci_core_conn_create to allowing empty destination nfc: nci: Fix nci_core_conn_close nfc: nci: Add an additional parameter to identify a connection id nfc: nci: Add nci_nfcc_loopback to the nci core nfc: st-nci: Move loopback usage from HCI to NCI Krzysztof Kozlowski (1): nfc: Drop owner assignment from i2c_driver Michael Thalmeier (10): NFC: pn533: Send ATR_REQ only if NFC_PROTO_NFC_DEP bit is set NFC: pn533: Fix socket deadlock NFC: pn533: Separate physical layer from the core implementation NFC: pn533: add I2C phy driver nfc: pn533: Add device tree documentation for i2c phy NFC: pn533: i2c: free irq on driver remove NFC: pn533: fix order of initialization NFC: pn533: i2c: do not call pn533_recv_frame with aborted commands NFC: pn533: reset poll modulation list before calling targets_found NFC: pn533: handle interrupted commands in pn533_recv_frame .../devicetree/bindings/net/nfc/pn533-i2c.txt | 31 + drivers/nfc/Kconfig| 11 +- drivers/nfc/Makefile |2 +- drivers/nfc/fdp/fdp.c |3 +- drivers/nfc/nxp-nci/i2c.c |1 - drivers/nfc/pn533/Kconfig | 27 + drivers/nfc/pn533/Makefile |9 + drivers/nfc/pn533/i2c.c| 281 + drivers/nfc/{ => pn533}/pn533.c| 1220 +--- drivers/nfc/pn533/pn533.h | 238 drivers/nfc/pn533/usb.c| 597 ++ drivers/nfc/pn544/i2c.c|1 - drivers/nfc/st-nci/i2c.c | 33 +- drivers/nfc/st-nci/se.c| 28 +- drivers/nfc/st-nci/spi.c | 32 +- drivers/nfc/st-nci/st-nci.h| 14 +- drivers/nfc/st-nci/vendor_cmds.c | 62 +- drivers/nfc/st21nfca/core.c| 13 +- drivers/nfc/st21nfca/i2c.c | 39 +- drivers/nfc/st21nfca/se.c |2 - include/net/nfc/nci_core.h | 17 +- net/nfc/nci/core.c | 117 +- net/nfc/nci/ntf.c |2 +- net/nfc/nci/rsp.c | 23 +- 24 files changed, 1695 insertions(+), 1108 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/nfc/pn533-i2c.txt create mode 100644 drivers/nfc/pn533/Kconfig create mode 100644 drivers/nfc/pn533/Makefile create mode 100644 drivers/nfc/pn533/i2c.c rename
[GIT] [4.6] NFC update
Hi David, This is a very small one this time, with only 5 patches. There are a couple of big items that could not be merged/finished on time. We have: - 2 LLCP fixes for a race and a potential OOM. - 2 cleanups for the pn544 and microread drivers. - 1 Maintainer addition for the s3fwrn5 driver. The following changes since commit 667f00630ebefc4d73aa105c6ab254e4aec867f8: Merge branch 'local-checksum-offload' (2016-02-12 05:52:41 -0500) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.6-1 for you to fetch changes up to 079c2652e5af648db6bf4f54bcafdafcc57a0d2c: MAINTAINERS: nfc: s3fwrn5: Add second maintainer (2016-03-10 17:16:22 +0100) Cong Wang (2): NFC: Use GFP_USER for user-controlled kmalloc NFC: Close a race condition in llcp_sock_getname() Jean Delvare (1): NFC: microread: Drop platform data header file Mika Westerberg (1): NFC: pn544: Drop two useless checks in ACPI probe path Robert Baldyga (1): MAINTAINERS: nfc: s3fwrn5: Add second maintainer MAINTAINERS | 2 +- drivers/nfc/microread/i2c.c | 8 drivers/nfc/pn544/i2c.c | 14 + include/linux/platform_data/microread.h | 35 - net/nfc/llcp_commands.c | 4 ++-- net/nfc/llcp_sock.c | 6 ++ 6 files changed, 10 insertions(+), 59 deletions(-) delete mode 100644 include/linux/platform_data/microread.h
Re: [PATCH v2 net] nfc: close a race condition in llcp_sock_getname()
Hi Cong, On Fri, Jan 29, 2016 at 11:37:40AM -0800, Cong Wang wrote: > llcp_sock_getname() checks llcp_sock->dev to make sure > llcp_sock is already connected or bound, however, we could > be in the middle of llcp_sock_bind() where llcp_sock->dev > is bound and llcp_sock->service_name_len is set, > but llcp_sock->service_name is not, in this case we would > lead to copy some bytes from a NULL pointer. > > Just lock the sock since this is not a hot path anyway. > > Reported-by: Dmitry Vyukov <dvyu...@google.com> > Cc: Lauro Ramos Venancio <lauro.venan...@openbossa.org> > Cc: Aloisio Almeida Jr <aloisio.alme...@openbossa.org> > Cc: Samuel Ortiz <sa...@linux.intel.com> > Signed-off-by: Cong Wang <xiyou.wangc...@gmail.com> > --- > net/nfc/llcp_sock.c | 6 ++ > 1 file changed, 6 insertions(+) Applied as well, thanks. Cheers, Samuel.
Re: [PATCH v2 net] nfc: use GFP_USER for user-controlled kmalloc
Hi Cong, On Fri, Jan 29, 2016 at 11:24:24AM -0800, Cong Wang wrote: > These two functions are called in sendmsg path, and the > 'len' is passed from user-space, so we should not allow > malicious users to OOM kernel on purpose. > > Reported-by: Dmitry Vyukov <dvyu...@google.com> > Cc: Lauro Ramos Venancio <lauro.venan...@openbossa.org> > Cc: Aloisio Almeida Jr <aloisio.alme...@openbossa.org> > Cc: Samuel Ortiz <sa...@linux.intel.com> > Signed-off-by: Cong Wang <xiyou.wangc...@gmail.com> > --- > net/nfc/llcp_commands.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Applied to nfc-next, thanks. Cheers, Samuel.
Re: [PATCH v2 net] nfc: use GFP_USER for user-controlled kmalloc
On Wed, Feb 24, 2016 at 10:41:29AM -0800, Cong Wang wrote: > On Fri, Jan 29, 2016 at 11:24 AM, Cong Wang <xiyou.wangc...@gmail.com> wrote: > > These two functions are called in sendmsg path, and the > > 'len' is passed from user-space, so we should not allow > > malicious users to OOM kernel on purpose. > > > > Reported-by: Dmitry Vyukov <dvyu...@google.com> > > Cc: Lauro Ramos Venancio <lauro.venan...@openbossa.org> > > Cc: Aloisio Almeida Jr <aloisio.alme...@openbossa.org> > > Cc: Samuel Ortiz <sa...@linux.intel.com> > > Signed-off-by: Cong Wang <xiyou.wangc...@gmail.com> > > Ping... > > David, this patch seems still not applied, I guess you expect NFC > maintainer to take it, but this doesn't happen. Could you take it? I'll look at it later today. Cheers, Samuel.
[GIT] [4.5] NFC update
Hi David, This is the first NFC pull request for 4.5 and it brings: - A new driver for the STMicroelectronics ST95HF NFC chipset. The ST95HF is an NFC digital transceiver with an embedded analog front-end and as such relies on the Linux NFC digital implementation. This is the 3rd user of the NFC digital stack. - ACPI support for the ST st-nci and st21nfca drivers. - A small improvement for the nfcsim driver, as we can now tune the Rx delay through sysfs. - A bunch of minor cleanups and small fixes from Christophe Ricard, for a few drivers and the NFC core code. The following changes since commit 7f151f1d8abb7d5930b49d4796b463dca1673cb7: Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2015-11-17 13:52:59 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.5-1 for you to fetch changes up to c6dc65d885b98898bf287aaf44e020077b41769f: NFC: nci: memory leak in nci_core_conn_create() (2015-12-29 19:06:23 +0100) Christophe Ricard (27): nfc: st-nci: Remove useless #include "ndlc.h" nfc: st-nci: Remove unneeded CONFIG_OF switches nfc: st21nfca: Remove unneeded CONFIG_OF switches nfc: nxp-nci: Remove #ifdef CONFIG_OF nfc: pn544: Remove #ifdef CONFIG_OF nfc: st-nci: Group device table together nfc: st21nfca: Group device table together nfc: st-nci: Add macro for gpio name nfc: st21nfca: Add macro for gpio name nfc: st-nci: Add support for acpi probing for i2c device. nfc: st-nci: Add support for acpi probing for spi device. nfc: st21nfca: Add support for acpi probing for i2c device. nfc: st-nci: Code cleanup nfc: st21nfca: Code cleanup nfc: st21nfca: Remove useless pr_info in st21nfca_hci_i2c_disable NFC: nci: Fix error check of nci_hci_create_pipe() result NFC: st-nci: Auto-select core module NFC: st21nfca: Auto-select core module nfc: netlink: HCI event connectivity implementation nfc: st-nci: Add support for HCI event connectivity nfc: st21nfca: Add support for HCI event connectivity MAINTAINERS: nfc: Add missing platform_data files references nfc: fdp: Move i2c client irq checking nfc: microread: Remove useless irq field nfc: microread: Fix header comment nfc: nxp-nci: Remove i2c client gpio irq configuration nfc: pn544: Remove i2c client gpio irq configuration Dan Carpenter (1): NFC: nci: memory leak in nci_core_conn_create() Fabio Estevam (1): nxp-nci: i2c: Do not check specifically for -EREMOTEIO error Geliang Tang (1): NFC: trf7970a: use to_spi_device Julia Lawall (1): nfc: s3fwrn5: constify s3fwrn5_phy_ops structures Saurabh Sengar (1): NFC: add rx delay sysfs parameter for nfcsim workqueue Shikha Singh (4): NFC: digital: Add Type4A tags support NFC: Add STMicroelectronics ST95HF driver DT: bindings: net: nfc: Add ST95HF binding doc NFC: st95hf: Fix build error .../devicetree/bindings/net/nfc/st95hf.txt | 50 + MAINTAINERS|5 + drivers/nfc/Kconfig|1 + drivers/nfc/Makefile |1 + drivers/nfc/fdp/i2c.c | 12 +- drivers/nfc/microread/i2c.c|2 - drivers/nfc/nfcsim.c | 10 +- drivers/nfc/nxp-nci/i2c.c | 34 +- drivers/nfc/pn544/i2c.c| 46 +- drivers/nfc/s3fwrn5/core.c |2 +- drivers/nfc/s3fwrn5/i2c.c |2 +- drivers/nfc/s3fwrn5/s3fwrn5.h |4 +- drivers/nfc/st-nci/Kconfig | 18 +- drivers/nfc/st-nci/i2c.c | 80 +- drivers/nfc/st-nci/ndlc.c |1 - drivers/nfc/st-nci/se.c|3 +- drivers/nfc/st-nci/spi.c | 81 +- drivers/nfc/st21nfca/Kconfig | 13 +- drivers/nfc/st21nfca/i2c.c | 80 +- drivers/nfc/st21nfca/se.c |5 +- drivers/nfc/st95hf/Kconfig | 10 + drivers/nfc/st95hf/Makefile|6 + drivers/nfc/st95hf/core.c | 1273 drivers/nfc/st95hf/spi.c | 167 +++ drivers/nfc/st95hf/spi.h | 64 + drivers/nfc/trf7970a.c |8 +- include/linux/platform_data/microread.h|2 +- include/net/nfc/nfc.h |1 + net/nfc/core.c | 13 + net/nfc/digital_core.c |3 +-
[GIT] [4.4] NFC fixes
Hi David, This is the 1st NFC fixes pull request for 4.4. It includes bug fixes and one fix for a build failure, all of them introduced with the first NFC pull request for 4.4. We have: - Fix nfcmrvl SPI driver potential build error due to a broken Kconfig dependency. - A few fixes for the firmware download implementation for the nfcmrvl UART driver. - A GPIO allocation leak for the nfcmrvl driver. - One code simplification for the nfcmrvl DT handling. The following changes since commit 1b1050cdc5cdde43177b375b5f22dc070d45d8f8: Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide (2015-11-04 10:12:43 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-fixes.git tags/nfc-fixes-4.4-1 for you to fetch changes up to 82aff3ea3b87892ce1476dad83de211741b3ac00: NFC: nfcmrvl: avoid being stuck on FW dnld timeout (2015-11-05 00:32:25 +0100) Arnd Bergmann (1): NFC: nfcmrvl: fix SPI driver dependencies Vincent Cuissard (5): NFC: nfcmrvl: avoid UART break control during FW download NFC: nfcmrvl: add a small wait after setting UART break NFC: nfcmrvl: free reset gpio NFC: nfcmrvl: remove unneeded CONFIG_OF switches NFC: nfcmrvl: avoid being stuck on FW dnld timeout drivers/nfc/nfcmrvl/Kconfig | 2 +- drivers/nfc/nfcmrvl/fw_dnld.c | 12 +--- drivers/nfc/nfcmrvl/main.c| 15 +++ drivers/nfc/nfcmrvl/uart.c| 26 +- 4 files changed, 22 insertions(+), 33 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT] [4.4] NFC update
Hi David, This is the NFC pull request for 4.4. It's a bit bigger than usual, the 3 main culprits being: - A new driver for Intel's Fields Peak NCI chipset. In order to support this chipset we had to export a few NCI routines and extend the driver NCI ops to not only support proprietary commands but also core ones. - Support for vendor commands for both STM drivers, st-nci and st21nfca. Those vendor commands allow to run factory tests through the NFC netlink interface. - New i2c and SPI support for the Marvell driver, together with firmware download support for this driver's core. Besides that we also have: - A few file renames in the STM drivers, to keep the naming consistent between drivers. - Some improvements and fixes on the NCI HCI layer, mostly to properly reach a secure element over a legacy HCI link. - A few fixes for the s3fwrn5 and trf7970a drivers. The following changes since commit f6d3125fa3c2f55ddf7cf69365c41089de6cfae6: Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2015-10-02 07:21:25 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.4-2 for you to fetch changes up to f11631748ee6973f85238109a3fa8ab8e760e5a4: NFC: nci: non-static functions can not be inline (2015-10-28 06:44:45 +0100) Axel Lin (2): nfc: s3fwrn5: Make NFC_S3FWRN5 select CRYPTO nfc: s3fwrn5: i2c: Use devm_request_threaded_irq to avoid irq leak Christophe JAILLET (1): NFC: nfcwilink: Drop a useless static qualifier Christophe Ricard (35): NFC: st-nci: Align st-nci driver with other nfc driver NFC: st-nci: include st-nci.h instead of ndlc.h NFC: st21nfca: Align st21nfca driver with other nfc driver NFC: st-nci: Fix incorrect spi buffer size NFC: nci: Fix incorrect data chaining when sending data NFC: nci: Fix improper management of HCI return code NFC: nci: extract pipe value using NCI_HCP_MSG_GET_PIPE NFC: nci: add nci_hci_clear_all_pipes functions NFC: nci: Call nci_hci_clear_all_pipes at HCI initial activation. NFC: nci: Create pipe on specific gate in nci_hci_connect_gate NFC: st-nci: Remove HCI init_data.gates initialization in load_session NFC: st21nfca: Remove HCI gates initialization in load_session NFC: st-nci: Open NCI_HCI_LINK_MGMT_PIPE NFC: st21nfca: Open NFC_HCI_LINK_MGMT_PIPE NFC: st-nci: Keep st_nci_gates unchanged in load_session NFC: st21nfca: Keep st21nfca_gates unchanged in load_session NFC: st-nci: initialize gate_count in st_nci_hci_network_init NFC: st-nci: Add support for NCI_HCI_IDENTITY_MGMT_GATE NFC: st-nci: Fix st_nci_gates offset NFC: st21nfca: Fix st21nfca_gates offset NFC: st-nci: Add support for proprietary commands NFC: st-nci: Add error messages when an unexpected HCI event occurs NFC: netlink: Add missing NFC_ATTR comments NFC: st-nci: Add ese-present/uicc-present dts properties NFC: st-nci: Increase delay between 2 secure element activations NFC: st-nci: Fix host_list verification after SE activation NFC: st21nfca: Fix host_list verification after SEactivation NFC: netlink: Add mode parameter to deactivate_target functions NFC: st-nci: Add few code style fixes NFC: st21nfca: Add few code style fixes NFC: st21nfca: Add error messages for unexpected HCI events NFC: st-nci: Disable irq when powering the device up NFC: st-nci: remove duplicated skb dump NFC: st-nci: Replace st21nfcb by st_nci in makefile NFC: st21nfca: Add support for proprietary commands Javier Martinez Canillas (1): NFC: trf7970a: Add OF match table Jean Delvare (3): NFC: pn544: Auto-select core module NFC: microread: Auto-select core module NFC: nfcmrvl: Auto-select core module Julia Lawall (2): NFC: nxp-nci: constify nxp_nci_phy_ops structure NFC: delete null dereference Robert Dolca (11): NFC: nci: Export nci data send API NFC: nci: Add function to get max packet size for conn NFC: nci: Introduce new core opcodes NFC: nci: Do not call post_setup when setup fails NFC: nci: Introduce nci_core_cmd NFC: nci: Allow the driver to set handler for core nci ops NFC: nci: rename nci_prop_ops to nci_driver_ops NFC: nci: fix possible crash in nci_core_conn_create NFC: nci: add nci_get_conn_info_by_id function NFC: Add Intel Fields Peak NFC solution driver NFC: nci: non-static functions can not be inline Samuel Ortiz (2): NFC: nci: Use __nci_request for exported routines NFC: st-nci: Rename st-nci_se.c Valentin Rothberg (1): NFC: s3fwrn5: Remove superfluous cflags Vincent Cuissard (9): NFC: nfcmrvl: remove unneeded version defines NFC: NCI: export nci_send_frame and nci_send_cmd
Re: [PATCH 1/2] NFC: delete null dereference
Hi Julia, On Sat, Oct 17, 2015 at 11:32:19AM +0200, Julia Lawall wrote: > The exit label performs device_unlock(>dev);, which will fail when dev > is NULL, and nfc_put_device(dev);, which is not useful when dev is NULL, so > just exit the function immediately. > > Problem found using scripts/coccinelle/null/deref_null.cocci > > Signed-off-by: Julia Lawall> > --- > net/nfc/netlink.c |6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) Applied to nfc-next, thanks. Cheers, Samuel. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] nfc: netlink: avoid NULL pointer dereference on error
Hi Vincent, On Wed, Oct 07, 2015 at 11:33:19AM +0200, Vincent Stehlé wrote: > The function nfc_genl_llc_sdreq() can dereference the dev pointer while > it is NULL on its error path. Create a new error handling label to avoid > that. > > This fixes the following coccinelle error: > > ./net/nfc/netlink.c:1175:21-24: ERROR: dev is NULL but dereferenced. > > Signed-off-by: Vincent Stehlé <vincent.ste...@laposte.net> > Cc: Thierry Escande <thierry.esca...@linux.intel.com> > Cc: Samuel Ortiz <sa...@linux.intel.com> > --- > net/nfc/netlink.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c > index 853172c..51c48f0 100644 > --- a/net/nfc/netlink.c > +++ b/net/nfc/netlink.c > @@ -,7 +,7 @@ static int nfc_genl_llc_sdreq(struct sk_buff *skb, > struct genl_info *info) > dev = nfc_get_device(idx); > if (!dev) { > rc = -ENODEV; > - goto exit; > + goto exit_nodev; > } Julia Lawall sent a better fix that I applied: - if (!dev) { - rc = -ENODEV; - goto exit; - } + if (!dev) + return -ENODEV; Cheers, Samuel. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT] [4.3] NFC update
Hi David, This is the NFC pull request for 4.3. With this one we have: - A new driver for Samsung's S3FWRN5 NFC chipset. In order to properly support this driver, a few NCI core routines needed to be exported. Future drivers like Intel's Fields Peak will benefit from this. - SPI support as a physical transport for STM st21nfcb. - An additional netlink API for sending replies back to userspace from vendor commands. - 2 small fixes for TI's trf7970a - A few st-nci fixes. The following changes since commit d52736e24fe2e927c26817256f8d1a3c8b5d51a0: Merge branch 'vrf-lite' (2015-08-13 22:43:22 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.3-1 for you to fetch changes up to 29e76924cf087bc6a9114a9244828fd13ae959bb: nfc: netlink: Add capability to reply to vendor_cmd with data (2015-08-20 22:00:11 +0200) Christophe Ricard (14): nfc: st-nci: Remove duplicate file platform_data/st_nci.h nfc: st-nci: Fix typo when changing from st21nfcb to st-nci nfc: st-nci: Fix non accurate comment for st_nci_i2c_read NFC: st21nfca: fix use of uninitialized variables in error path NFC: st-nci: fix use of uninitialized variables in error path nfc: st-nci: Remove data from ack_pending_q when receiving a SYNC_ACK nfc: st-nci: Free data with irrelevant NDLC PCB_SYNC value nfc: st-nci: Add spi phy support for st21nfcb nfc: st-nci: Add device tree documentation for spi phy nfc: st-nci: Remove pr_err in rcv_queue when ndlc header is unknown nfc: netlink: Add check on NFC_ATTR_VENDOR_DATA nfc: netlink: Warning fix nfc: nci: hci: Add check on skb nci_hci_send_cmd parameter nfc: netlink: Add capability to reply to vendor_cmd with data Mark Greer (2): NFC: trf7970a: SDD_EN is bit 5 not bit 3 NFC: trf7970a: Add NULL check to clear up smatch warning Robert Baldyga (3): NFC: nci: Add post_setup handler NFC: nci: export nci_core_reset and nci_core_init nfc: s3fwrn5: Add driver for Samsung S3FWRN5 NFC Chip .../devicetree/bindings/net/nfc/s3fwrn5.txt| 27 ++ .../net/nfc/{st-nci.txt = st-nci-i2c.txt} | 0 .../devicetree/bindings/net/nfc/st-nci-spi.txt | 31 ++ MAINTAINERS| 6 + drivers/nfc/Kconfig| 1 + drivers/nfc/Makefile | 1 + drivers/nfc/s3fwrn5/Kconfig| 19 + drivers/nfc/s3fwrn5/Makefile | 11 + drivers/nfc/s3fwrn5/core.c | 219 + drivers/nfc/s3fwrn5/firmware.c | 511 + drivers/nfc/s3fwrn5/firmware.h | 111 + drivers/nfc/s3fwrn5/i2c.c | 306 drivers/nfc/s3fwrn5/nci.c | 165 +++ drivers/nfc/s3fwrn5/nci.h | 89 drivers/nfc/s3fwrn5/s3fwrn5.h | 99 drivers/nfc/st-nci/Kconfig | 11 + drivers/nfc/st-nci/Makefile| 3 + drivers/nfc/st-nci/i2c.c | 23 +- drivers/nfc/st-nci/ndlc.c | 7 +- drivers/nfc/st-nci/spi.c | 392 drivers/nfc/st-nci/st-nci_se.c | 8 +- drivers/nfc/st21nfca/st21nfca.c| 11 +- drivers/nfc/trf7970a.c | 6 +- include/linux/platform_data/st_nci.h | 29 -- include/net/nfc/nci_core.h | 3 + include/net/nfc/nfc.h | 41 ++ net/nfc/nci/core.c | 18 + net/nfc/nci/hci.c | 2 +- net/nfc/netlink.c | 91 +++- 29 files changed, 2180 insertions(+), 61 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/nfc/s3fwrn5.txt rename Documentation/devicetree/bindings/net/nfc/{st-nci.txt = st-nci-i2c.txt} (100%) create mode 100644 Documentation/devicetree/bindings/net/nfc/st-nci-spi.txt create mode 100644 drivers/nfc/s3fwrn5/Kconfig create mode 100644 drivers/nfc/s3fwrn5/Makefile create mode 100644 drivers/nfc/s3fwrn5/core.c create mode 100644 drivers/nfc/s3fwrn5/firmware.c create mode 100644 drivers/nfc/s3fwrn5/firmware.h create mode 100644 drivers/nfc/s3fwrn5/i2c.c create mode 100644 drivers/nfc/s3fwrn5/nci.c create mode 100644 drivers/nfc/s3fwrn5/nci.h create mode 100644 drivers/nfc/s3fwrn5/s3fwrn5.h create mode 100644 drivers/nfc/st-nci/spi.c delete mode 100644 include/linux/platform_data/st_nci.h -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at
[GIT] [4.2] 2nd NFC update
Hi David, This is a follow up fix for a typo that I introduced while cleaning the 1st 4.2 NFC pull request patches. The following changes since commit d0dcad8bd32a34aa85bcbd5d2033658cb3964377: NFC: nfcmrvl: set PB_BAIL_OUT at setup (2015-06-13 00:08:55 +0200) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.2-2 for you to fetch changes up to fb77ff4f43990dc91926ce2704036a547482544e: NFC: nci: fix mistake in uart generic driver (2015-06-15 18:10:37 +0200) Vincent Cuissard (1): NFC: nci: fix mistake in uart generic driver net/nfc/nci/uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[GIT] [4.2] NFC update
Hi David, This is the NFC pull request for 4.2: - NCI drivers can now define their own handlers for processing proprietary NCI responses and notifications. - NFC vendors can use a dedicated netlink API to send their own proprietary commands, like e.g. all commands needed to implement vendor specific manufacturing tools. - A new generic NCI over UART driver against which any NCI chipset running on top of a serial interface can register. - The st21nfcb driver is renamed to st-nci as it can and will support most of ST Microelectronics NCI chipsets. - The st21nfcb driver can put its CLF in hibernate mode and save significant amount of power. - A few st21nfcb minor fixes. - The NXP NCI driver now supports ACPI enumeration. - The Marvell NCI driver now supports both USB and serial physical interfaces. - The Marvell NCI drivers also supports NCI frames being muxed over HCI. This is a setting that can be defined by a DT property. The following changes since commit 6da8253bdd3945b81377e4908d6d395a9956f8af: net: phy: bcm7xxx: update workaround to fix 100BaseT corner cases (2015-06-08 12:16:25 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git tags/nfc-next-4.2-1 for you to fetch changes up to d0dcad8bd32a34aa85bcbd5d2033658cb3964377: NFC: nfcmrvl: set PB_BAIL_OUT at setup (2015-06-13 00:08:55 +0200) Christophe Ricard (14): NFC: nci: Add NCI_RESET return code check before setup NFC: nci: Add nci init ops for early device initialization NFC: nci: Add nci_prop_cmd allowing to send proprietary nci cmd NFC: st21nfcb: Do not remove header once the payload is sent NFC: st21nfcb: remove st21nfcb_nci_i2c_disable NFC: st21nfcb: Add ndlc_close in st21nfcb_nci_remove NFC: st21nfcb: Fix st21nfcb_nci_close NFC: st21nfcb: Add support for nci proprietary commands NFC: nci: Move close ops call in nci_close_device NFC: st21nfcb: Move st21nfcb_nci_remove in ndlc_remove NFC: st21nfcb: Move powered flag from phy to ndlc layer NFC: st21nfcb: disable irq when st21nfcb is disabled NFC: st21nfcb: Configure CLF with NCI proprietary command nfc: st-nci: Rename st21nfcb to st-nci Firo Yang (1): NFC: st21nfcb: Remove inappropriate kfree on a devm_kzalloc pointer Joe Perches (1): NFC: nci: hci: Fix releasing uninitialized skbs Mark A. Greer (1): NFC: trf7970a: Handle extra byte in response to Type 5 RMB commands Masanari Iida (1): NFC: Fix typo in nfc-hci.txt Oleg Zhurakivskyy (1): NFC: nxp-nci_i2c: Add support for enumerating through ACPI Samuel Ortiz (5): NFC: nxp-nci: Fix build warning NFC: nci: Handle proprietary response and notifications NFC: Introduce vendor commands structures NFC: netlink: Implement vendor command support NFC: nci: Export nci_req_complete Tomas Winkler (1): NFC: microread: drop unused variable Uwe Kleine-König (1): NFC: pn544: use flags argument of devm_gpiod_get to set direction Valentin Rothberg (1): NFC: Remove obsolete setting of DEBUG Vincent Cuissard (12): NFC: nfcmrvl: remove integration related settings NFC: nfcmrvl: add support of HCI-based transport NFC: nfcmrvl: update nci recv frame API NFC: nfcmrvl: update USB device id NFC: nfcmrvl: add chip reset management NFC: nci: add generic uart support NFC: nfcmrvl: add platform_data and DT configuration NFC: nfcmrvl: add UART driver NFC: nfcmrvl: small fix in USB driver NFC: nfcmrvl: Allow ISO15693 protocol NFC: nci: remove current SLEEP mode management NFC: nfcmrvl: set PB_BAIL_OUT at setup .../devicetree/bindings/net/nfc/nfcmrvl.txt| 29 ++ .../bindings/net/nfc/{st21nfcb.txt = st-nci.txt} | 4 +- .../devicetree/bindings/net/nfc/trf7970a.txt | 4 + Documentation/nfc/nfc-hci.txt | 2 +- drivers/nfc/Kconfig| 2 +- drivers/nfc/Makefile | 4 +- drivers/nfc/microread/i2c.c| 3 - drivers/nfc/nfcmrvl/Kconfig| 11 + drivers/nfc/nfcmrvl/Makefile | 3 + drivers/nfc/nfcmrvl/main.c | 134 +- drivers/nfc/nfcmrvl/nfcmrvl.h | 60 ++- drivers/nfc/nfcmrvl/uart.c | 225 ++ drivers/nfc/nfcmrvl/usb.c | 27 +- drivers/nfc/nxp-nci/Makefile | 2 - drivers/nfc/nxp-nci/i2c.c | 52 +++ drivers/nfc/pn544/i2c.c| 43 +- drivers/nfc/st-nci/Kconfig | 23 + drivers/nfc/st-nci/Makefile| 9 + drivers/nfc/st-nci/core.c | 179 drivers/nfc
Re: [PATCH] NFC: nci: hci: Fix releasing uninitialized skbs
Hi Joe, On Sun, May 31, 2015 at 05:44:45PM -0700, Joe Perches wrote: Several of these goto exit; uses should be direct returns as skb is not yet initialized by nci_hci_get_param(). Miscellanea: o Use !memcmp instead of memcmp() == 0 o Remove unnecessary goto from if () {... goto exit;} else {...} exit: Signed-off-by: Joe Perches j...@perches.com --- net/nfc/nci/hci.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) Applied to nfc-next, thanks. Cheers, Samuel. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [linux-nfc] [PATCH 8/8] NFC: Add Intel FieldsPeak NFC solution driver
Hi Robert, On Wed, Apr 01, 2015 at 06:35:31PM +0300, Robert Dolca wrote: On Thu, Mar 26, 2015 at 2:30 AM, Samuel Ortiz sa...@linux.intel.com wrote: + /* If a patch was applied the new version is checked */ + if (patched) { + r = nci_init(ndev); + if (r) + goto error; + + r = fdp_nci_get_versions(ndev); + if (r) + goto error; + + if (info-otp_version != info-otp_patch_version || + info-ram_version != info-ram_patch_version) { + pr_err(FRP firmware update failed); + r = -EINVAL; + } + } + + /* Check if the device has VSC */ + if (fdp_post_fw_vsc_cfg[0]) { + /* Set the vendor specific configuration */ + r = fdp_nci_set_production_data(ndev, fdp_post_fw_vsc_cfg[3], + fdp_post_fw_vsc_cfg[4]); + if (r) + goto error; + } + + /* Set clock type and frequency */ + r = fdp_nci_set_clock(ndev, 0, 26000); + if (r) + goto error; The version checking, production data setting and clock setting should be part of a post setup notification call. Please add an nci_dev notify() ops that could get called on certain events, for example when NCI is up. Bluetooth's HCI does something along those lines already. From this notification hook you could implement this post setup stage. The idea is for your setup routine to only do firmware update and nothing else. It will make it shorter, and thus easier to read as well. If the RAM patch wasn't applied successfully the device can't be used so the setup function should fail. If the production data (specifically the clock frequency) is not set the device can not be used. If the user space tries to start polling before the notification is sent the polling will fail. Having it called later would mean introducing a race condition. Sure. Then I'd rather have an additional NCI hook (e.g. ndev-ops-open()) called synchronously after the setup stage that could fail and make open fail as well. The idea here is to separate the 2 parts of your logic and make the code more readable. Cheers, Samuel. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [linux-nfc] [PATCH 3/8] NFC: NCI: Adds NCI init and reset API for drivers
Hi Robert, On Tue, Mar 31, 2015 at 05:05:53PM +0300, Robert Dolca wrote: On Thu, Mar 26, 2015 at 2:29 AM, Samuel Ortiz sa...@linux.intel.com wrote: Hi Robert, On Tue, Feb 24, 2015 at 12:01:47PM +0200, Robert Dolca wrote: In order to communicate with the device during the setup phase, the driver may need to initialize the device. After the setup is done the driver should reset the device to leave it in the same state that it was before the setup function call. I would prefer not to export those symbols, but instead introduce a quirk bitmap to let the NCI core know that your device expects the core to be initialized before calling the setup ops. That would be done from nci_open_device(). As part of the initialization / firmware upgrade procedure the driver needs to reset and initialize the NCI connection multiple times. Having the connection initialized before calling setup is not enough. Fair enough, I am ok with exporting those symbols. BTW after looking at your setup routine, I think this is wrong: + /* Load firmware from disk */ + r = fdp_nci_request_firmware(ndev); + if (r) + goto error; You should be able to boot your NFC chipset without a local patch. If there is one, then you can try patching your device, but otherwise we should continue with the exisiting one. Cheers, Samuel. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [linux-nfc] [PATCH 1/8] NFC: NCI: Allow connection close with dev down
Hi Robert, On Tue, Mar 31, 2015 at 05:03:42PM +0300, Robert Dolca wrote: On Thu, Mar 26, 2015 at 2:29 AM, Samuel Ortiz sa...@linux.intel.com wrote: Hi Robert, On Tue, Feb 24, 2015 at 12:01:45PM +0200, Robert Dolca wrote: By calling __nci_request instead of nci_request allows the driver to use the function while initializing the device (setup stage) Signed-off-by: Robert Dolca robert.do...@intel.com --- net/nfc/nci/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 9575a18..c4dd5d8 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -558,7 +558,7 @@ static void nci_core_conn_close_req(struct nci_dev *ndev, unsigned long opt) int nci_core_conn_close(struct nci_dev *ndev, u8 conn_id) { - return nci_request(ndev, nci_core_conn_close_req, conn_id, + return __nci_request(ndev, nci_core_conn_close_req, conn_id, msecs_to_jiffies(NCI_CMD_TIMEOUT)); You're fixing your problem by removing the NCI request serialization and removing the check for your device being UP. I assume you need to open and close a proprietary connection from your setup hook ? Then please extend nci_request() to check for both NCI_UP and NCI_INIT. You are right, I am opening and closing a connection from the setup function. The setup is called by nci_open_device. At the beginning of nci_open_device, req_lock is being acquired and it is release at the end of the function. That means that when setup is being called req_lock is acuired. As you said I can modify nci_request to check for NCI_INIT but it tries to acquire req_lock and it can not succeed. I see, I thought the issue was only about checking the NCI_* flags. As a short term solution, I propose you do the following: a) Export nci_core_conn_create_req, nci_core_conn_close_req and __nci_request. b) Call __nci_request() directly from your fdp_nci_close_conn() and fdp_nci_create_conn() routines. The long term, scalable fix would be to implement and export an __nci_send_cmd_sync() routine, that would transparently build an NCI request and tail it to the ndev req skb queue, and put the caller on a wait queue. The created request's response callback would then wake the caller up. Cheers, Samuel. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [IrDA] LMP discovery timer not started by default
Hi Dave, By default, LMP sets up a 3 seconds timer for discovery. We don't need it until discovery is set to 1. This patch is against your latest net-2.6.25 tree. From: Ross Burton [EMAIL PROTECTED] Signed-off-by: Ross Burton [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/irlmp.c |7 +-- net/irda/irlmp_event.c |4 +--- net/irda/irsysctl.c| 28 +++- 3 files changed, 33 insertions(+), 6 deletions(-) Index: net-2.6.25/net/irda/irlmp.c === --- net-2.6.25.orig/net/irda/irlmp.c2008-01-14 19:27:06.0 +0100 +++ net-2.6.25/net/irda/irlmp.c 2008-01-23 00:57:12.0 +0100 @@ -103,9 +103,12 @@ irlmp-last_lsap_sel = 0x0f; /* Reserved 0x00-0x0f */ strcpy(sysctl_devname, Linux); - /* Do discovery every 3 seconds */ init_timer(irlmp-discovery_timer); - irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout*HZ); + + /* Do discovery every 3 seconds, conditionaly */ + if (sysctl_discovery) + irlmp_start_discovery_timer(irlmp, + sysctl_discovery_timeout*HZ); return 0; } Index: net-2.6.25/net/irda/irlmp_event.c === --- net-2.6.25.orig/net/irda/irlmp_event.c 2008-01-14 19:27:06.0 +0100 +++ net-2.6.25/net/irda/irlmp_event.c 2008-01-23 00:57:38.0 +0100 @@ -174,9 +174,7 @@ /* We always cleanup the log (active passive discovery) */ irlmp_do_expiry(); - /* Active discovery is conditional */ - if (sysctl_discovery) - irlmp_do_discovery(sysctl_discovery_slots); + irlmp_do_discovery(sysctl_discovery_slots); /* Restart timer */ irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout * HZ); Index: net-2.6.25/net/irda/irsysctl.c === --- net-2.6.25.orig/net/irda/irsysctl.c 2008-01-14 19:27:06.0 +0100 +++ net-2.6.25/net/irda/irsysctl.c 2008-01-22 21:30:30.0 +0100 @@ -29,6 +29,8 @@ #include linux/init.h #include net/irda/irda.h /* irda_debug */ +#include net/irda/irlmp.h +#include net/irda/timer.h #include net/irda/irias_object.h extern int sysctl_discovery; @@ -45,6 +47,8 @@ extern int sysctl_warn_noreply_time; extern int sysctl_lap_keepalive_time; +extern struct irlmp_cb *irlmp; + /* this is needed for the proc_dointvec_minmax - Jean II */ static int max_discovery_slots = 16; /* ??? */ static int min_discovery_slots = 1; @@ -85,6 +89,27 @@ return ret; } + +static int do_discovery(ctl_table *table, int write, struct file *filp, +void __user *buffer, size_t *lenp, loff_t *ppos) +{ + int ret; + + ret = proc_dointvec(table, write, filp, buffer, lenp, ppos); + if (ret) + return ret; + + if (irlmp == NULL) + return -ENODEV; + + if (sysctl_discovery) + irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout*HZ); + else + del_timer_sync(irlmp-discovery_timer); + + return ret; +} + /* One file */ static ctl_table irda_table[] = { { @@ -93,7 +118,8 @@ .data = sysctl_discovery, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec + .proc_handler = do_discovery, + .strategy = sysctl_intvec }, { .ctl_name = NET_IRDA_DEVNAME, -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [IrDA] af_irda memory leak fixes
Hi Dave, Here goes an IrDA patch against your latest net-2.6 tree. This patch fixes some af_irda memory leaks. It also checks for irias_new_obect() return value. Signed-off-by: Jesper Juhl [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/af_irda.c | 30 +++--- 1 file changed, 27 insertions(+), 3 deletions(-) Index: net-2.6-davem/net/irda/af_irda.c === --- net-2.6-davem.orig/net/irda/af_irda.c 2008-01-17 06:00:10.0 +0100 +++ net-2.6-davem/net/irda/af_irda.c2008-01-18 08:37:36.0 +0100 @@ -802,12 +802,18 @@ } #endif /* CONFIG_IRDA_ULTRA */ + self-ias_obj = irias_new_object(addr-sir_name, jiffies); + if (self-ias_obj == NULL) + return -ENOMEM; + err = irda_open_tsap(self, addr-sir_lsap_sel, addr-sir_name); - if (err 0) + if (err 0) { + kfree(self-ias_obj-name); + kfree(self-ias_obj); return err; + } /* Register with LM-IAS */ - self-ias_obj = irias_new_object(addr-sir_name, jiffies); irias_add_integer_attrib(self-ias_obj, IrDA:TinyTP:LsapSel, self-stsap_sel, IAS_KERNEL_ATTR); irias_insert_object(self-ias_obj); @@ -1825,7 +1831,7 @@ struct irda_ias_set*ias_opt; struct ias_object *ias_obj; struct ias_attrib * ias_attr; /* Attribute in IAS object */ - int opt; + int opt, free_ias = 0; IRDA_DEBUG(2, %s(%p)\n, __FUNCTION__, self); @@ -1881,11 +1887,20 @@ /* Create a new object */ ias_obj = irias_new_object(ias_opt-irda_class_name, jiffies); + if (ias_obj == NULL) { + kfree(ias_opt); + return -ENOMEM; + } + free_ias = 1; } /* Do we have the attribute already ? */ if(irias_find_attrib(ias_obj, ias_opt-irda_attrib_name)) { kfree(ias_opt); + if (free_ias) { + kfree(ias_obj-name); + kfree(ias_obj); + } return -EINVAL; } @@ -1904,6 +1919,11 @@ if(ias_opt-attribute.irda_attrib_octet_seq.len IAS_MAX_OCTET_STRING) { kfree(ias_opt); + if (free_ias) { + kfree(ias_obj-name); + kfree(ias_obj); + } + return -EINVAL; } /* Add an octet sequence attribute */ @@ -1932,6 +1952,10 @@ break; default : kfree(ias_opt); + if (free_ias) { + kfree(ias_obj-name); + kfree(ias_obj); + } return -EINVAL; } irias_insert_object(ias_obj); -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] [IrDA] Race between open and disconnect in irda-usb
It seems to me that irda_usb_net_open() must set self-netopen under spinlock or disconnect() may fail to kill all URBs, if it is called while an interface is opened. From: Oliver Neukum [EMAIL PROTECTED] Signed-off-by: Oliver Neukum [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/irda-usb.c |5 + 1 file changed, 5 insertions(+) Index: net-2.6/drivers/net/irda/irda-usb.c === --- net-2.6.orig/drivers/net/irda/irda-usb.c2007-11-25 05:53:43.0 +0100 +++ net-2.6/drivers/net/irda/irda-usb.c 2007-11-25 07:12:09.0 +0100 @@ -1168,6 +1168,7 @@ static int irda_usb_net_open(struct net_device *netdev) { struct irda_usb_cb *self; + unsigned long flags; charhwname[16]; int i; @@ -1177,13 +1178,16 @@ self = (struct irda_usb_cb *) netdev-priv; IRDA_ASSERT(self != NULL, return -1;); + spin_lock_irqsave(self-lock, flags); /* Can only open the device if it's there */ if(!self-present) { + spin_unlock_irqrestore(self-lock, flags); IRDA_WARNING(%s(), device not present!\n, __FUNCTION__); return -1; } if(self-needspatch) { + spin_unlock_irqrestore(self-lock, flags); IRDA_WARNING(%s(), device needs patch\n, __FUNCTION__) ; return -EIO ; } @@ -1198,6 +1202,7 @@ /* To do *before* submitting Rx urbs and starting net Tx queue * Jean II */ self-netopen = 1; + spin_unlock_irqrestore(self-lock, flags); /* * Now that everything should be initialized properly, -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/5] [IrDA] IrDA net-2.6 fixes
Hi Dave, Here goes a batch of 5 IrDA patches against your latest net-2.6 tree. Cheers, Samuel. -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/5] [IrDA] irda parameters warning fixes.
This patch fixes: CHECK /home/kernel/src/net/irda/parameters.c /home/kernel/src/net/irda/parameters.c:466:2: warning: Using plain integer as NULL pointer /home/kernel/src/net/irda/parameters.c:520:2: warning: Using plain integer as NULL pointer /home/kernel/src/net/irda/parameters.c:573:2: warning: Using plain integer as NULL pointer From: Richard Knutsson [EMAIL PROTECTED] Signed-off-by: Richard Knutsson [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] Cc: Andrew Morton [EMAIL PROTECTED] --- net/irda/parameters.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: net-2.6/net/irda/parameters.c === --- net-2.6.orig/net/irda/parameters.c 2007-11-25 05:54:02.0 +0100 +++ net-2.6/net/irda/parameters.c 2007-11-26 10:20:38.0 +0100 @@ -463,7 +463,7 @@ int n = 0; IRDA_ASSERT(buf != NULL, return ret;); - IRDA_ASSERT(info != 0, return ret;); + IRDA_ASSERT(info != NULL, return ret;); pi_minor = pi info-pi_mask; pi_major = pi info-pi_major_offset; @@ -517,7 +517,7 @@ int n = 0; IRDA_ASSERT(buf != NULL, return ret;); - IRDA_ASSERT(info != 0, return ret;); + IRDA_ASSERT(info != NULL, return ret;); pi_minor = buf[n] info-pi_mask; pi_major = buf[n] info-pi_major_offset; @@ -570,7 +570,7 @@ int n = 0; IRDA_ASSERT(buf != NULL, return ret;); - IRDA_ASSERT(info != 0, return ret;); + IRDA_ASSERT(info != NULL, return ret;); /* * Parse all parameters. Each parameter must be at least two bytes -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/5] [IrDA] irlmp_unregister_link needs to free lsaps
While testing the mcs7780 based IrDA USB dongle I've stumbled upon memory leak in irlmp_unregister_link(). Hashbin for lsaps is created in irlmp_register_link and should probably be freed in irlmp_unregister_link(). Signed-off-by: Hinko Kocevar [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/irlmp.c |1 + 1 file changed, 1 insertion(+) Index: net-2.6/net/irda/irlmp.c === --- net-2.6.orig/net/irda/irlmp.c 2007-11-25 05:54:02.0 +0100 +++ net-2.6/net/irda/irlmp.c2007-11-25 07:12:13.0 +0100 @@ -353,6 +353,7 @@ /* Final cleanup */ del_timer(link-idle_timer); link-magic = 0; + hashbin_delete(link-lsaps, (FREE_FUNC) __irlmp_close_lsap); kfree(link); } } -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5] [IrDA] stir4200 fixes
The attached patch observes the stir4200 fifo size and will clear the fifo, if the size is increasing, while it should be transmitting bytes From: Olaf Hartmann [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/stir4200.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) Index: net-2.6/drivers/net/irda/stir4200.c === --- net-2.6.orig/drivers/net/irda/stir4200.c2007-11-25 05:53:43.0 +0100 +++ net-2.6/drivers/net/irda/stir4200.c 2007-11-26 02:16:12.0 +0100 @@ -142,9 +142,6 @@ }; enum StirFifoCtlMask { - FIFOCTL_EOF = 0x80, - FIFOCTL_UNDER = 0x40, - FIFOCTL_OVER = 0x20, FIFOCTL_DIR = 0x10, FIFOCTL_CLR = 0x08, FIFOCTL_EMPTY = 0x04, @@ -594,9 +591,10 @@ { int err; unsigned long count, status; + unsigned long prev_count = 0x1fff; /* Read FIFO status and count */ - for(;;) { + for (;; prev_count = count) { err = read_reg(stir, REG_FIFOCTL, stir-fifo_status, FIFO_REGS_SIZE); if (unlikely(err != FIFO_REGS_SIZE)) { @@ -629,6 +627,10 @@ if (space = 0 STIR_FIFO_SIZE - 4 space + count) return 0; + /* queue confused */ + if (prev_count count) + break; + /* estimate transfer time for remaining chars */ msleep((count * 8000) / stir-speed); } -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] [IrDA] mcs7780 needs to free allocated rx buffer
While testing the mcs7780 based IrDA USB dongle I've stumbled upon memory leak in mcs_net_close(). Patch below fixes it. From: Hinko Kocevar [EMAIL PROTECTED] Signed-off-by: Hinko Kocevar [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/mcs7780.c |2 ++ 1 file changed, 2 insertions(+) Index: net-2.6/drivers/net/irda/mcs7780.c === --- net-2.6.orig/drivers/net/irda/mcs7780.c 2007-11-25 05:53:43.0 +0100 +++ net-2.6/drivers/net/irda/mcs7780.c 2007-11-25 07:12:11.0 +0100 @@ -677,6 +677,8 @@ /* Stop transmit processing */ netif_stop_queue(netdev); + kfree_skb(mcs-rx_buff.skb); + /* kill and free the receive and transmit URBs */ usb_kill_urb(mcs-rx_urb); usb_free_urb(mcs-rx_urb); -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/5] [IrDA] irlmp_unregister_link needs to free lsaps
While testing the mcs7780 based IrDA USB dongle I've stumbled upon memory leak in irlmp_unregister_link(). Hashbin for lsaps is created in irlmp_register_link and should probably be freed in irlmp_unregister_link(). Signed-off-by: Hinko Kocevar [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/irlmp.c |1 + 1 file changed, 1 insertion(+) Index: net-2.6/net/irda/irlmp.c === --- net-2.6.orig/net/irda/irlmp.c 2007-11-25 05:54:02.0 +0100 +++ net-2.6/net/irda/irlmp.c2007-11-25 07:12:13.0 +0100 @@ -353,6 +353,7 @@ /* Final cleanup */ del_timer(link-idle_timer); link-magic = 0; + hashbin_delete(link-lsaps, (FREE_FUNC) __irlmp_close_lsap); kfree(link); } } -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/5] [IrDA] stir4200 fixes
The attached patch observes the stir4200 fifo size and will clear the fifo, if the size is increasing, while it should be transmitting bytes From: Olaf Hartmann [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/stir4200.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) Index: net-2.6/drivers/net/irda/stir4200.c === --- net-2.6.orig/drivers/net/irda/stir4200.c2007-11-25 05:53:43.0 +0100 +++ net-2.6/drivers/net/irda/stir4200.c 2007-11-26 02:16:12.0 +0100 @@ -142,9 +142,6 @@ }; enum StirFifoCtlMask { - FIFOCTL_EOF = 0x80, - FIFOCTL_UNDER = 0x40, - FIFOCTL_OVER = 0x20, FIFOCTL_DIR = 0x10, FIFOCTL_CLR = 0x08, FIFOCTL_EMPTY = 0x04, @@ -594,9 +591,10 @@ { int err; unsigned long count, status; + unsigned long prev_count = 0x1fff; /* Read FIFO status and count */ - for(;;) { + for (;; prev_count = count) { err = read_reg(stir, REG_FIFOCTL, stir-fifo_status, FIFO_REGS_SIZE); if (unlikely(err != FIFO_REGS_SIZE)) { @@ -629,6 +627,10 @@ if (space = 0 STIR_FIFO_SIZE - 4 space + count) return 0; + /* queue confused */ + if (prev_count count) + break; + /* estimate transfer time for remaining chars */ msleep((count * 8000) / stir-speed); } -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/5] [IrDA] mcs7780 needs to free allocated rx buffer
While testing the mcs7780 based IrDA USB dongle I've stumbled upon memory leak in mcs_net_close(). Patch below fixes it. Signed-off-by: Hinko Kocevar [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/mcs7780.c |2 ++ 1 file changed, 2 insertions(+) Index: net-2.6/drivers/net/irda/mcs7780.c === --- net-2.6.orig/drivers/net/irda/mcs7780.c 2007-11-25 05:53:43.0 +0100 +++ net-2.6/drivers/net/irda/mcs7780.c 2007-11-25 07:12:11.0 +0100 @@ -677,6 +677,8 @@ /* Stop transmit processing */ netif_stop_queue(netdev); + kfree_skb(mcs-rx_buff.skb); + /* kill and free the receive and transmit URBs */ usb_kill_urb(mcs-rx_urb); usb_free_urb(mcs-rx_urb); -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/5] [IrDA] IrDA updates for net-2.6
Hi Herbert, Here goes a series of 5 IrDA patches against your latest net-2.6 tree. Cheers, Samuel. -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/5] [IrDA] irda parameters warning fixes.
This patch fixes: CHECK /home/kernel/src/net/irda/parameters.c /home/kernel/src/net/irda/parameters.c:466:2: warning: Using plain integer as NULL pointer /home/kernel/src/net/irda/parameters.c:520:2: warning: Using plain integer as NULL pointer /home/kernel/src/net/irda/parameters.c:573:2: warning: Using plain integer as NULL pointer Signed-off-by: Richard Knutsson [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] Cc: Andrew Morton [EMAIL PROTECTED] --- net/irda/parameters.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: net-2.6/net/irda/parameters.c === --- net-2.6.orig/net/irda/parameters.c 2007-11-25 05:54:02.0 +0100 +++ net-2.6/net/irda/parameters.c 2007-11-26 10:20:38.0 +0100 @@ -463,7 +463,7 @@ int n = 0; IRDA_ASSERT(buf != NULL, return ret;); - IRDA_ASSERT(info != 0, return ret;); + IRDA_ASSERT(info != NULL, return ret;); pi_minor = pi info-pi_mask; pi_major = pi info-pi_major_offset; @@ -517,7 +517,7 @@ int n = 0; IRDA_ASSERT(buf != NULL, return ret;); - IRDA_ASSERT(info != 0, return ret;); + IRDA_ASSERT(info != NULL, return ret;); pi_minor = buf[n] info-pi_mask; pi_major = buf[n] info-pi_major_offset; @@ -570,7 +570,7 @@ int n = 0; IRDA_ASSERT(buf != NULL, return ret;); - IRDA_ASSERT(info != 0, return ret;); + IRDA_ASSERT(info != NULL, return ret;); /* * Parse all parameters. Each parameter must be at least two bytes -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] [IrDA] Race between open and disconnect in irda-usb
It seems to me that irda_usb_net_open() must set self-netopen under spinlock or disconnect() may fail to kill all URBs, if it is called while an interface is opened. Signed-off-by: Oliver Neukum [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/irda-usb.c |5 + 1 file changed, 5 insertions(+) Index: net-2.6/drivers/net/irda/irda-usb.c === --- net-2.6.orig/drivers/net/irda/irda-usb.c2007-11-25 05:53:43.0 +0100 +++ net-2.6/drivers/net/irda/irda-usb.c 2007-11-25 07:12:09.0 +0100 @@ -1168,6 +1168,7 @@ static int irda_usb_net_open(struct net_device *netdev) { struct irda_usb_cb *self; + unsigned long flags; charhwname[16]; int i; @@ -1177,13 +1178,16 @@ self = (struct irda_usb_cb *) netdev-priv; IRDA_ASSERT(self != NULL, return -1;); + spin_lock_irqsave(self-lock, flags); /* Can only open the device if it's there */ if(!self-present) { + spin_unlock_irqrestore(self-lock, flags); IRDA_WARNING(%s(), device not present!\n, __FUNCTION__); return -1; } if(self-needspatch) { + spin_unlock_irqrestore(self-lock, flags); IRDA_WARNING(%s(), device needs patch\n, __FUNCTION__) ; return -EIO ; } @@ -1198,6 +1202,7 @@ /* To do *before* submitting Rx urbs and starting net Tx queue * Jean II */ self-netopen = 1; + spin_unlock_irqrestore(self-lock, flags); /* * Now that everything should be initialized properly, -- -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [PATCH]race between open and disconnect in irda-usb
Hi Oliver, On Fri, Oct 12, 2007 at 10:53:55AM +0200, Oliver Neukum wrote: Hi, it seems to me that irda_usb_net_open() must set self-netopen under spinlock or disconnect() may fail to kill all URBs, if it is called while an interface is opened. Makes sense, yes. I will push it upstream with my next IrDA update. Cheers, Samuel. Signed-off-by: Oliver Neukum [EMAIL PROTECTED] Regards Oliver --- a/drivers/net/irda/irda-usb.c 2007-10-11 17:24:35.0 +0200 +++ b/drivers/net/irda/irda-usb.c 2007-10-11 17:30:30.0 +0200 @@ -1168,6 +1168,7 @@ static int stir421x_patch_device(struct static int irda_usb_net_open(struct net_device *netdev) { struct irda_usb_cb *self; + unsigned long flags; charhwname[16]; int i; @@ -1177,13 +1178,16 @@ static int irda_usb_net_open(struct net_ self = (struct irda_usb_cb *) netdev-priv; IRDA_ASSERT(self != NULL, return -1;); + spin_lock_irqsave(self-lock, flags); /* Can only open the device if it's there */ if(!self-present) { + spin_unlock_irqrestore(self-lock, flags); IRDA_WARNING(%s(), device not present!\n, __FUNCTION__); return -1; } if(self-needspatch) { + spin_unlock_irqrestore(self-lock, flags); IRDA_WARNING(%s(), device needs patch\n, __FUNCTION__) ; return -EIO ; } @@ -1198,6 +1202,7 @@ static int irda_usb_net_open(struct net_ /* To do *before* submitting Rx urbs and starting net Tx queue * Jean II */ self-netopen = 1; + spin_unlock_irqrestore(self-lock, flags); /* * Now that everything should be initialized properly, - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now http://get.splunk.com/ ___ irda-users mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/irda-users - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] IrDA: Oops fix for ksdazzle
Hi Dave, This is the last remaining patch for IrDA, against net-2.6.24. It fixes a kernel oops triggered by the ksdazzle SIR driver. We need more space for input frames, and 2048 should be plenty of it. Signed-off-by: Alex Villacís Lasso [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/ksdazzle-sir.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) Index: net-2.6.24-quilt/drivers/net/irda/ksdazzle-sir.c === --- net-2.6.24-quilt.orig/drivers/net/irda/ksdazzle-sir.c 2007-10-01 01:53:56.0 +0300 +++ net-2.6.24-quilt/drivers/net/irda/ksdazzle-sir.c2007-10-01 01:53:58.0 +0300 @@ -1,7 +1,7 @@ /* * * Filename: ksdazzle.c -* Version: 0.1.1 +* Version: 0.1.2 * Description: Irda KingSun Dazzle USB Dongle * Status:Experimental * Author:Alex Villacís Lasso [EMAIL PROTECTED] @@ -113,6 +113,7 @@ #define KINGSUN_REQ_SEND 0x09 #define KINGSUN_SND_FIFO_SIZE2048 /* Max packet we can send */ +#define KINGSUN_RCV_MAX 2048 /* Max transfer we can receive */ struct ksdazzle_speedparams { __le32 baudrate;/* baud rate, little endian */ @@ -150,7 +151,7 @@ __u8 tx_payload[8]; struct urb *rx_urb; - __u8 rx_payload[8]; + __u8 *rx_buf; iobuff_t rx_unwrap_buff; struct usb_ctrlrequest *speed_setuprequest; @@ -440,7 +441,8 @@ /* Start reception. */ usb_fill_int_urb(kingsun-rx_urb, kingsun-usbdev, usb_rcvintpipe(kingsun-usbdev, kingsun-ep_in), -kingsun-rx_payload, 8, ksdazzle_rcv_irq, kingsun, 1); +kingsun-rx_buf, KINGSUN_RCV_MAX, ksdazzle_rcv_irq, +kingsun, 1); kingsun-rx_urb-status = 0; err = usb_submit_urb(kingsun-rx_urb, GFP_KERNEL); if (err) { @@ -641,6 +643,7 @@ kingsun-tx_buf_clear_sent = 0; kingsun-rx_urb = NULL; + kingsun-rx_buf = NULL; kingsun-rx_unwrap_buff.in_frame = FALSE; kingsun-rx_unwrap_buff.state = OUTSIDE_FRAME; kingsun-rx_unwrap_buff.skb = NULL; @@ -651,6 +654,11 @@ kingsun-speed_urb = NULL; kingsun-speedparams.baudrate = 0; + /* Allocate input buffer */ + kingsun-rx_buf = kmalloc(KINGSUN_RCV_MAX, GFP_KERNEL); + if (!kingsun-rx_buf) + goto free_mem; + /* Allocate output buffer */ kingsun-tx_buf_clear = kmalloc(KINGSUN_SND_FIFO_SIZE, GFP_KERNEL); if (!kingsun-tx_buf_clear) @@ -714,6 +722,7 @@ free_mem: kfree(kingsun-speed_setuprequest); kfree(kingsun-tx_buf_clear); + kfree(kingsun-rx_buf); free_netdev(net); err_out1: return ret; @@ -746,6 +755,7 @@ kfree(kingsun-speed_setuprequest); kfree(kingsun-tx_buf_clear); + kfree(kingsun-rx_buf); free_netdev(kingsun-netdev); usb_set_intfdata(intf, NULL); - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] [IrDA] MSG_NOSIGNAL support for IrDA sockets
Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/af_irda.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) Index: net-2.6.24-quilt/net/irda/af_irda.c === --- net-2.6.24-quilt.orig/net/irda/af_irda.c2007-08-25 02:41:39.0 +0300 +++ net-2.6.24-quilt/net/irda/af_irda.c 2007-08-25 02:41:41.0 +0300 @@ -1245,18 +1245,17 @@ struct sock *sk = sock-sk; struct irda_sock *self; struct sk_buff *skb; - int err; + int err = -EPIPE; IRDA_DEBUG(4, %s(), len=%zd\n, __FUNCTION__, len); /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ - if (msg-msg_flags ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT)) + if (msg-msg_flags ~(MSG_DONTWAIT | MSG_EOR | MSG_CMSG_COMPAT | + MSG_NOSIGNAL)) return -EINVAL; - if (sk-sk_shutdown SEND_SHUTDOWN) { - send_sig(SIGPIPE, current, 0); - return -EPIPE; - } + if (sk-sk_shutdown SEND_SHUTDOWN) + goto out_err; if (sk-sk_state != TCP_ESTABLISHED) return -ENOTCONN; @@ -1283,7 +1282,7 @@ skb = sock_alloc_send_skb(sk, len + self-max_header_size + 16, msg-msg_flags MSG_DONTWAIT, err); if (!skb) - return -ENOBUFS; + goto out_err; skb_reserve(skb, self-max_header_size + 16); skb_reset_transport_header(skb); @@ -1291,7 +1290,7 @@ err = memcpy_fromiovec(skb_transport_header(skb), msg-msg_iov, len); if (err) { kfree_skb(skb); - return err; + goto out_err; } /* @@ -1301,10 +1300,14 @@ err = irttp_data_request(self-tsap, skb); if (err) { IRDA_DEBUG(0, %s(), err=%d\n, __FUNCTION__, err); - return err; + goto out_err; } /* Tell client how much data we actually sent */ return len; + + out_err: + return sk_stream_error(sk, msg-msg_flags, err); + } /* -- - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] [IrDA] Kingsun KS-959 IrDA USB driver
This dongle does not follow the usb-irda specification, so it needs its own special driver. First, it uses control URBs for data transfer, instead of bulk or interrupt transfers; the only interrupt endpoint exposed seems to be a dummy to prevent the interface from being rejected. Second, it uses obfuscation and padding at the USB traffic level, for no apparent reason other than to make reverse engineering harder (full details on obfuscation in comments at beginning of source). Although it is advertised as a 4 Mbps FIR dongle, it apparently loses packets at speeds greater than 57600 bps. On plugin, this dongle reports vendor and device IDs: 0x07d0:0x4959 . The Windows driver that is used normally to control this dongle has a filename of KS-959.SYS . Signed-off-by: Alex VillacÃs Lasso [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/Kconfig | 14 drivers/net/irda/Makefile|1 drivers/net/irda/ks959-sir.c | 939 +++ 3 files changed, 954 insertions(+) Index: net-2.6.24-quilt/drivers/net/irda/Kconfig === --- net-2.6.24-quilt.orig/drivers/net/irda/Kconfig 2007-08-25 02:43:16.0 +0300 +++ net-2.6.24-quilt/drivers/net/irda/Kconfig 2007-08-25 03:05:15.0 +0300 @@ -176,6 +176,20 @@ To compile it as a module, choose M here: the module will be called ksdazzle-sir. +config KS959_DONGLE + tristate KingSun KS-959 IrDA-USB dongle (EXPERIMENTAL) + depends on IRDA USB EXPERIMENTAL + help + Say Y or M here if you want to build support for the KingSun KS-959 + IrDA-USB bridge device driver. + + This USB bridge does not conform to the IrDA-USB device class + specification, and therefore needs its own specific driver. This + dongle supports SIR speeds only (9600 through 57600 bps). + + To compile it as a module, choose M here: the module will be called + ks959-sir. + comment Old SIR device drivers config IRPORT_SIR Index: net-2.6.24-quilt/drivers/net/irda/ks959-sir.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ net-2.6.24-quilt/drivers/net/irda/ks959-sir.c 2007-08-25 03:04:30.0 +0300 @@ -0,0 +1,939 @@ +/* +* +* Filename: ks959-sir.c +* Version: 0.1.2 +* Description: Irda KingSun KS-959 USB Dongle +* Status:Experimental +* Author:Alex VillacÃs Lasso [EMAIL PROTECTED] +* with help from Domen Puncer [EMAIL PROTECTED] +* +*Based on stir4200, mcs7780, kingsun-sir drivers. +* +*This program is free software; you can redistribute it and/or modify +*it under the terms of the GNU General Public License as published by +*the Free Software Foundation; either version 2 of the License. +* +*This program is distributed in the hope that it will be useful, +*but WITHOUT ANY WARRANTY; without even the implied warranty of +*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*GNU General Public License for more details. +* +*You should have received a copy of the GNU General Public License +*along with this program; if not, write to the Free Software +*Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*/ + +/* + * Following is my most current (2007-07-17) understanding of how the Kingsun + * KS-959 dongle is supposed to work. This information was deduced by + * reverse-engineering and examining the USB traffic captured with USBSnoopy + * from the WinXP driver. Feel free to update here as more of the dongle is + * known. + * + * My most sincere thanks must go to Domen Puncer [EMAIL PROTECTED] for + * invaluable help in cracking the obfuscation and padding required for this + * dongle. + * + * General: This dongle exposes one interface with one interrupt IN endpoint. + * However, the interrupt endpoint is NOT used at all for this dongle. Instead, + * this dongle uses control transfers for everything, including sending and + * receiving the IrDA frame data. Apparently the interrupt endpoint is just a + * dummy to ensure the dongle has a valid interface to present to the PC.And I + * thought the DonShine dongle was weird... In addition, this dongle uses + * obfuscation (?!?!), applied at the USB level, to hide the traffic, both sent + * and received, from the dongle. I call it obfuscation because the XOR keying + * and padding required to produce an USB traffic acceptable for the dongle can + * not be explained by any other technical requirement. + * + * Transmission: To transmit an IrDA frame, the driver must prepare a control + * URB with the following as a setup packet: + *bRequestTypeUSB_DIR_OUT
[PATCH 2/3] [IrDA] Kingsun Dazzle IrDA USB driver
This dongle does not follow the usb-irda specification, so it needs its own special driver. Just like the Kingsun/Donshine dongle, it exposes two interrupt endpoints. Reception is performed through direct reads from the input endpoint. Transmission requires splitting the IrDA frames into 8-byte segments, in which the first byte encodes how many of the remaining 7 bytes are used as data. Speed change is made with a control URB just like the one in cypress_m8, and it seems to support up to 115200 bps. On plugin, this dongle reports vendor and device IDs: 0x07d0:0x4100 Signed-off-by: Alex VillacÃs Lasso [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/Kconfig| 12 drivers/net/irda/Makefile |1 drivers/net/irda/ksdazzle-sir.c | 823 3 files changed, 836 insertions(+) Index: net-2.6.24-quilt/drivers/net/irda/Kconfig === --- net-2.6.24-quilt.orig/drivers/net/irda/Kconfig 2007-08-24 14:55:19.0 +0300 +++ net-2.6.24-quilt/drivers/net/irda/Kconfig 2007-08-25 02:43:16.0 +0300 @@ -162,7 +162,19 @@ Say Y here if you want to build support for the Cirrus logic EP7211 chipset's infrared module. +config KSDAZZLE_DONGLE + tristate KingSun Dazzle IrDA-USB dongle (EXPERIMENTAL) + depends on IRDA USB EXPERIMENTAL + help + Say Y or M here if you want to build support for the KingSun Dazzle + IrDA-USB bridge device driver. + This USB bridge does not conform to the IrDA-USB device class + specification, and therefore needs its own specific driver. This + dongle supports SIR speeds only (9600 through 115200 bps). + + To compile it as a module, choose M here: the module will be called + ksdazzle-sir. comment Old SIR device drivers Index: net-2.6.24-quilt/drivers/net/irda/ksdazzle-sir.c === --- /dev/null 1970-01-01 00:00:00.0 + +++ net-2.6.24-quilt/drivers/net/irda/ksdazzle-sir.c2007-08-25 02:42:20.0 +0300 @@ -0,0 +1,823 @@ +/* +* +* Filename: ksdazzle.c +* Version: 0.1.1 +* Description: Irda KingSun Dazzle USB Dongle +* Status:Experimental +* Author:Alex VillacÃs Lasso [EMAIL PROTECTED] +* +*Based on stir4200, mcs7780, kingsun-sir drivers. +* +*This program is free software; you can redistribute it and/or modify +*it under the terms of the GNU General Public License as published by +*the Free Software Foundation; either version 2 of the License. +* +*This program is distributed in the hope that it will be useful, +*but WITHOUT ANY WARRANTY; without even the implied warranty of +*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*GNU General Public License for more details. +* +*You should have received a copy of the GNU General Public License +*along with this program; if not, write to the Free Software +*Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*/ + +/* + * Following is my most current (2007-07-26) understanding of how the Kingsun + * 07D0:4100 dongle (sometimes known as the MA-660) is supposed to work. This + * information was deduced by examining the USB traffic captured with USBSnoopy + * from the WinXP driver. Feel free to update here as more of the dongle is + * known. + * + * General: This dongle exposes one interface with two interrupt endpoints, one + * IN and one OUT. In this regard, it is similar to what the Kingsun/Donshine + * dongle (07c0:4200) exposes. Traffic is raw and needs to be wrapped and + * unwrapped manually as in stir4200, kingsun-sir, and ks959-sir. + * + * Transmission: To transmit an IrDA frame, it is necessary to wrap it, then + * split it into multiple segments of up to 7 bytes each, and transmit each in + * sequence. It seems that sending a single big block (like kingsun-sir does) + * won't work with this dongle. Each segment needs to be prefixed with a value + * equal to (unsigned char)0xF8 + number of bytes in segment, inside a payload + * of exactly 8 bytes. For example, a segment of 1 byte gets prefixed by 0xF9, + * and one of 7 bytes gets prefixed by 0xFF. The bytes at the end of the + * payload, not considered by the prefix, are ignored (set to 0 by this + * implementation). + * + * Reception: To receive data, the driver must poll the dongle regularly (like + * kingsun-sir.c) with interrupt URBs. If data is available, it will be returned + * in payloads from 0 to 8 bytes long. When concatenated, these payloads form + * a raw IrDA stream that needs to be unwrapped as in stir4200 and kingsun-sir + * + * Speed change: To change the speed of the dongle
[PATCH 0/3] [IrDA] IrDA updates for net-2.6.24
Hi Dave, Here go 3 IrDA patches for net-2.6.24 inclusion. Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [net-2.6.24] forcedeth does not compile without CONFIG_FORCEDETH_NAPI set
Hi Oliver, On Fri, Aug 10, 2007 at 07:34:03PM +0200, Oliver Hartkopp wrote: Checking some other source with the current net-2.6.24 GIT, i just discovered this: CC drivers/net/mii.o CC drivers/net/Space.o CC drivers/net/loopback.o CC drivers/net/b44.o CC drivers/net/forcedeth.o drivers/net/forcedeth.c: In function nv_nic_irq: drivers/net/forcedeth.c:3017: error: RX_WORK_PER_LOOP undeclared (first use in this function) drivers/net/forcedeth.c:3017: error: (Each undeclared identifier is reported only once drivers/net/forcedeth.c:3017: error: for each function it appears in.) make[2]: *** [drivers/net/forcedeth.o] Error 1 make[1]: *** [drivers/net] Error 2 make: *** [drivers] Error 2 This only occurs the CONFIG_FORCEDETH_NAPI is _disabled_. This fixes the build: -- Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] drivers/net/forcedeth.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 37732f9..90eef4a 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c @@ -2973,6 +2973,8 @@ static void nv_link_irq(struct net_device *dev) dprintk(KERN_DEBUG %s: link change notification done.\n, dev-name); } +#define TX_WORK_PER_LOOP 64 +#define RX_WORK_PER_LOOP 64 static irqreturn_t nv_nic_irq(int foo, void *data) { struct net_device *dev = (struct net_device *) data; @@ -3083,8 +3085,6 @@ static irqreturn_t nv_nic_irq(int foo, void *data) return IRQ_RETVAL(i); } -#define TX_WORK_PER_LOOP 64 -#define RX_WORK_PER_LOOP 64 /** * All _optimized functions are used to help increase performance * (reduce CPU and increase throughput). They use descripter version 3, - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [IrDA] KS959 USB IrDA dongle support
On 7/23/2007, David Miller [EMAIL PROTECTED] wrote: From: Samuel Ortiz [EMAIL PROTECTED] Date: Mon, 23 Jul 2007 00:32:17 +0300 Last IrDA patch for 2.6.23-rc1, if it's not too late... Too late, Linus just closed the merge window, you had two weeks to submit this :-) Too bad... I submitted it as soon as it was ready. Will we have to wait until the 2.6.24 merge window, or can it be applied earlier as it's a fully standalone driver ? Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [IrDA] KS959 USB IrDA dongle support
Hi Dave, Last IrDA patch for 2.6.23-rc1, if it's not too late... This patch adds support for the KingSun KS-959 USB IrDA dongle. This dongle does not follow the usb-irda specification, so it needs its own special driver. First, it uses control URBs for data transfer, instead of bulk or interrupt transfers; the only interrupt endpoint exposed seems to be a dummy to prevent the interface from being rejected. Second, it uses obfuscation and padding at the USB traffic level, for no apparent reason other than to make reverse engineering harder (full details on obfuscation in comments at beginning of source). Although it is advertised as a 4 Mbps FIR dongle, it apparently loses packets at speeds greater than 57600 bps. On plugin, this dongle reports vendor and device IDs: 0x07d0:0x4959 . From: Alex Villacís Lasso [EMAIL PROTECTED] Signed-off-by: Alex Villacís Lasso [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/Kconfig | 14 + drivers/net/irda/Makefile|1 + drivers/net/irda/ks959-sir.c | 919 ++ 3 files changed, 934 insertions(+), 0 deletions(-) create mode 100644 drivers/net/irda/ks959-sir.c diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig index 2098d0a..35321dc 100644 --- a/drivers/net/irda/Kconfig +++ b/drivers/net/irda/Kconfig @@ -164,6 +164,20 @@ config EP7211_DONGLE +config KS959_DONGLE + tristate KingSun KS-959 IrDA-USB dongle + depends on IRDA USB EXPERIMENTAL + help + Say Y or M here if you want to build support for the KingSun KS-959 + IrDA-USB bridge device driver. + + This USB bridge does not conform to the IrDA-USB device class + specification, and therefore needs its own specific driver. + This dongle supports SIR speeds only (9600 through 57600 bps). + + To compile it as a module, choose M here: the module will be called + ks959-sir. + comment Old SIR device drivers config IRPORT_SIR diff --git a/drivers/net/irda/Makefile b/drivers/net/irda/Makefile index 2808ef5..9212c15 100644 --- a/drivers/net/irda/Makefile +++ b/drivers/net/irda/Makefile @@ -47,6 +47,7 @@ obj-$(CONFIG_MA600_DONGLE)+= ma600-sir.o obj-$(CONFIG_TOIM3232_DONGLE) += toim3232-sir.o obj-$(CONFIG_EP7211_DONGLE)+= ep7211-sir.o obj-$(CONFIG_KINGSUN_DONGLE) += kingsun-sir.o +obj-$(CONFIG_KS959_DONGLE) += ks959-sir.o # The SIR helper module sir-dev-objs := sir_dev.o sir_dongle.o diff --git a/drivers/net/irda/ks959-sir.c b/drivers/net/irda/ks959-sir.c new file mode 100644 index 000..12e3435 --- /dev/null +++ b/drivers/net/irda/ks959-sir.c @@ -0,0 +1,919 @@ +/* +* +* Filename: ks959-sir.c +* Version: 0.1.2 +* Description: Irda KingSun KS-959 USB Dongle +* Status:Experimental +* Author:Alex Villacís Lasso [EMAIL PROTECTED] +* with help from Domen Puncer [EMAIL PROTECTED] +* +*Based on stir4200, mcs7780, kingsun-sir drivers. +* +*This program is free software; you can redistribute it and/or modify +*it under the terms of the GNU General Public License as published by +*the Free Software Foundation; either version 2 of the License. +* +*This program is distributed in the hope that it will be useful, +*but WITHOUT ANY WARRANTY; without even the implied warranty of +*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +*GNU General Public License for more details. +* +*You should have received a copy of the GNU General Public License +*along with this program; if not, write to the Free Software +*Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*/ + +/* + * Following is my most current (2007-07-17) understanding of how the Kingsun + * KS-959 dongle is supposed to work. This information was deduced by + * reverse-engineering and examining the USB traffic captured with USBSnoopy + * from the WinXP driver. Feel free to update here as more of the dongle is + * known. + * + * My most sincere thanks must go to Domen Puncer [EMAIL PROTECTED] for + * invaluable help in cracking the obfuscation and padding required for this + * dongle. + * + * General: This dongle exposes one interface with one interrupt IN endpoint. + * However, the interrupt endpoint is NOT used at all for this dongle. Instead, + * this dongle uses control transfers for everything, including sending and + * receiving the IrDA frame data. Apparently the interrupt endpoint is just a + * dummy to ensure the dongle has a valid interface to present to the PC. And I + * thought the DonShine dongle was weird... In addition, this dongle uses + * obfuscation (?!?!?), applied at the USB level, to hide the traffic, both sent + * and received, from the dongle. I call it obfuscation because the XOR keying
[PATCH] [IrDA] Fix IrDA build failure
Hi Dave, When having built-in IrDA, we hit the following error: `irda_sysctl_unregister' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irda_proc_unregister' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irsock_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irttp_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `iriap_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irda_device_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irlap_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irlmp_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o make[1]: *** [.tmp_vmlinux1] Error 1 make: *** [_all] Error 2 This is due to the irda_init fix recently added, where we call __exit routines from an __init one. It is a build failure that I didn't catch because it doesn't show up when building IrDA as a module. My apologies for that. The following patch fixes that failure and is against your net-2.6 tree. I hope it can make it to the merge window, and [EMAIL PROTECTED] is CCed on this mail. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index dcd7e32..4c670cf 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -2567,7 +2567,7 @@ int __init irsock_init(void) *Remove IrDA protocol * */ -void __exit irsock_cleanup(void) +void irsock_cleanup(void) { sock_unregister(PF_IRDA); proto_unregister(irda_proto); diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 7b5def1..435b563 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c @@ -95,14 +95,14 @@ int __init irda_device_init( void) return 0; } -static void __exit leftover_dongle(void *arg) +static void leftover_dongle(void *arg) { struct dongle_reg *reg = arg; IRDA_WARNING(IrDA: Dongle type %x not unregistered\n, reg-type); } -void __exit irda_device_cleanup(void) +void irda_device_cleanup(void) { IRDA_DEBUG(4, %s()\n, __FUNCTION__); diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 774eb70..ee3889f 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c @@ -153,7 +153,7 @@ int __init iriap_init(void) *Initializes the IrIAP layer, called by the module cleanup code in *irmod.c */ -void __exit iriap_cleanup(void) +void iriap_cleanup(void) { irlmp_unregister_service(service_handle); diff --git a/net/irda/irlap.c b/net/irda/irlap.c index 2fc9f51..3d76aaf 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c @@ -95,7 +95,7 @@ int __init irlap_init(void) return 0; } -void __exit irlap_cleanup(void) +void irlap_cleanup(void) { IRDA_ASSERT(irlap != NULL, return;); diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 24a5e3f..7efa930 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c @@ -116,7 +116,7 @@ int __init irlmp_init(void) *Remove IrLMP layer * */ -void __exit irlmp_cleanup(void) +void irlmp_cleanup(void) { /* Check for main structure */ IRDA_ASSERT(irlmp != NULL, return;); diff --git a/net/irda/irproc.c b/net/irda/irproc.c index d6f9aba..181cb51 100644 --- a/net/irda/irproc.c +++ b/net/irda/irproc.c @@ -84,7 +84,7 @@ void __init irda_proc_register(void) *Unregister irda entry in /proc file system * */ -void __exit irda_proc_unregister(void) +void irda_proc_unregister(void) { int i; diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c index 2e968e7..957e04f 100644 --- a/net/irda/irsysctl.c +++ b/net/irda/irsysctl.c @@ -287,7 +287,7 @@ int __init irda_sysctl_register(void) *Unregister our sysctl interface * */ -void __exit irda_sysctl_unregister(void) +void irda_sysctl_unregister(void) { unregister_sysctl_table(irda_table_header); } diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 7f50832..3d7ab03 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -109,7 +109,7 @@ int __init irttp_init(void) *Called by module destruction/cleanup code * */ -void __exit irttp_cleanup(void) +void irttp_cleanup(void) { /* Check for main structure */ IRDA_ASSERT(irttp-magic == TTP_MAGIC, return;); - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [PATCH] [IrDA] Fix IrDA build failure
On Mon, Jul 16, 2007 at 02:17:15PM +0300, Samuel Ortiz wrote: Hi Dave, When having built-in IrDA, we hit the following error: `irda_sysctl_unregister' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irda_proc_unregister' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irsock_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irttp_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `iriap_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irda_device_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irlap_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o `irlmp_cleanup' referenced in section `.init.text' of net/built-in.o: defined in discarded section `.exit.text' of net/built-in.o make[1]: *** [.tmp_vmlinux1] Error 1 make: *** [_all] Error 2 This is due to the irda_init fix recently added, where we call __exit routines from an __init one. It is a build failure that I didn't catch because it doesn't show up when building IrDA as a module. My apologies for that. I forgot to mention that the build fails on ARM but not on x86. As Sam explained to me, x86 discards exit sections at runtime only, unlike ARM. I don't know about other platforms though. So, to hit this build failure, you need a combination of !x86 and built-in IrDA. Cheers, Samuel. The following patch fixes that failure and is against your net-2.6 tree. I hope it can make it to the merge window, and [EMAIL PROTECTED] is CCed on this mail. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index dcd7e32..4c670cf 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -2567,7 +2567,7 @@ int __init irsock_init(void) *Remove IrDA protocol * */ -void __exit irsock_cleanup(void) +void irsock_cleanup(void) { sock_unregister(PF_IRDA); proto_unregister(irda_proto); diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 7b5def1..435b563 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c @@ -95,14 +95,14 @@ int __init irda_device_init( void) return 0; } -static void __exit leftover_dongle(void *arg) +static void leftover_dongle(void *arg) { struct dongle_reg *reg = arg; IRDA_WARNING(IrDA: Dongle type %x not unregistered\n, reg-type); } -void __exit irda_device_cleanup(void) +void irda_device_cleanup(void) { IRDA_DEBUG(4, %s()\n, __FUNCTION__); diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 774eb70..ee3889f 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c @@ -153,7 +153,7 @@ int __init iriap_init(void) *Initializes the IrIAP layer, called by the module cleanup code in *irmod.c */ -void __exit iriap_cleanup(void) +void iriap_cleanup(void) { irlmp_unregister_service(service_handle); diff --git a/net/irda/irlap.c b/net/irda/irlap.c index 2fc9f51..3d76aaf 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c @@ -95,7 +95,7 @@ int __init irlap_init(void) return 0; } -void __exit irlap_cleanup(void) +void irlap_cleanup(void) { IRDA_ASSERT(irlap != NULL, return;); diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 24a5e3f..7efa930 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c @@ -116,7 +116,7 @@ int __init irlmp_init(void) *Remove IrLMP layer * */ -void __exit irlmp_cleanup(void) +void irlmp_cleanup(void) { /* Check for main structure */ IRDA_ASSERT(irlmp != NULL, return;); diff --git a/net/irda/irproc.c b/net/irda/irproc.c index d6f9aba..181cb51 100644 --- a/net/irda/irproc.c +++ b/net/irda/irproc.c @@ -84,7 +84,7 @@ void __init irda_proc_register(void) *Unregister irda entry in /proc file system * */ -void __exit irda_proc_unregister(void) +void irda_proc_unregister(void) { int i; diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c index 2e968e7..957e04f 100644 --- a/net/irda/irsysctl.c +++ b/net/irda/irsysctl.c @@ -287,7 +287,7 @@ int __init irda_sysctl_register(void) *Unregister our sysctl interface * */ -void __exit irda_sysctl_unregister(void) +void irda_sysctl_unregister(void) { unregister_sysctl_table(irda_table_header); } diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 7f50832..3d7ab03 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -109,7 +109,7 @@ int __init irttp_init(void) *Called by module destruction/cleanup code
Re: RFC: removing DONGLE_OLD drivers?
Hi Adrian, On Mon, Jul 09, 2007 at 07:25:39PM +0200, Adrian Bunk wrote: With one exception, all DONGLE_OLD drivers have newer counterparts. The DONGLE_OLD drivers depend on BROKEN_ON_SMP which e.g. implies that the many distributions shipping only SMP-kernels will never offer them. The one exception is a driver for the Cirrus Logic EDB-7211 evaluation board that itself is out of production for some years. Can we remove these old drivers or is there a good reason for keeping them? I didn't notice the ep7211 is only using the old dongle API. I'll convert it to the new one, and then we can start looking at getting rid of the old drivers. Cheers, Samuel. cu Adrian -- Is there not promise of rain? Ling Tan asked suddenly out of the darkness. There had been need of rain for many days. Only a promise, Lao Er said. Pearl S. Buck - Dragon Seed - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Generic netlink interface help
On Sun, May 27, 2007 at 07:47:59PM +0200, Rodolfo Giometti wrote: On Sun, May 27, 2007 at 03:54:30PM +0200, Johannes Berg wrote: It's written in python without using libnl: http://git.sipsolutions.net/pynl80211.git If I well understand I should do something like this: s = socket(PF_NETLINK, SOCK_RAW, NETLINK_GENERIC); memset(src_addr, 0, sizeof(src_addr)); src_addr.nl_family = AF_NETLINK; src_addr.nl_pid = 0;/* ask kernel to choose an unique ID */ src_addr.nl_groups = 0; /* not in mcast groups */ ret = bind(handle-socket, (struct sockaddr *) src_addr, sizeof(src_add to get access to the generic netlink, then I should request the generic family name but I don't understand in which structure I should put this request... Can you please halp me? You should first fetch your attributed family ID by sending a generic netlink request (CTRL_CMD_GETFAMILY) to the generic netlink control family (GENL_ID_CTRL). Once you have your family ID, you can build generic netlink messages and send them there. I'm linking with libnl, but you can have a look at my irconfig draft at http://sortiz.org/irda/irconfig.c Cheers, Samuel. Thanks a lot, Rodolfo -- GNU/Linux Solutions e-mail:[EMAIL PROTECTED] Linux Device Driver [EMAIL PROTECTED] Embedded Systems [EMAIL PROTECTED] UNIX programming phone: +39 349 2432127 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Generic netlink interface help
Hi Rodolfo, On Sun, May 27, 2007 at 07:39:59PM +0200, Rodolfo Giometti wrote: On Thu, May 24, 2007 at 09:43:30AM -, Samuel Ortiz wrote: You could look at Johannes Berg 802.11 generic netlink implementation for a good example (net/wireless/nl80211.c in John Linville's tree): http://git.kernel.org/?p=linux/kernel/git/linville/wireless-dev.git;a=blob;f=net/wireless/nl80211.c;h=d6a44a386c2b86b81514b08d3c9b324dd2c7d229;hb=HEAD Looking at that code I suppose that if I want send/receive struct pps_netlink_msg to/from the kernel I have to define: static struct genl_family pps_gnl_family = { .id = GENL_ID_GENERATE,/* don't bother with a hardcoded ID */ .name= PPS, .hdrsize = 0, /* no private header */ .version = PPS_FAMILY_VER, .maxattr = 1, }; static struct nla_policy pps_genl_policy[1] = { [0] = { .type = NLA_BINARY, .len = sizeof(struct pps_netlink_msg), }, }; static struct genl_ops pps_gnl_ops = { .cmd = 0x1, .policy = pps_genl_policy, .doit= pps_genl_data_ready, }; Then the pps_genl_data_ready() should do: static int pps_genl_data_ready(struct sk_buff *skb, struct genl_info *info) { struct pps_netlink_msg *msg = nla_data(info-attrs[0]); int cmd, source; unsigned long timeout; int ret; if (!msg) return -EINVAL; /* Do the job and put the answer into msg struct itself... */ genlmsg_unicast(skb, info-snd_pid); return 0; } Is that right? At first glance, this could work yes. However, it seems you're trying to encapsulate your pps_netlink_msg into a generic netlink message which itself is already encapsulated into a netlink message, and then multiplex all your PPS commands on ppl_genl_data_ready(). IMHO, you should have your different PPS commands declared as a genl_ops array, and then have a specific doit routine per PPS command. This would make your code cleaner and more secure (see the Operation Granularity section at http://linux-net.osdl.org/index.php/Generic_Netlink_HOWTO). Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Generic netlink interface help
Hi Rodolfo, On 5/24/2007, Rodolfo Giometti [EMAIL PROTECTED] wrote: Hello, I'm trying to use this new API for my LinuxPPS support but I have some difficulties in understanding the code! Looking at http://linux-net.osdl.org/index.php/Generic_Netlink_HOWTO is not clear... for example in line: msg_head = genlmsg_put(skb, pid, seq, type, 0, flags, DOC_EXMPL_C_ECHO, 1); what pid, seq, type and flags stand for? It could be possible to have a little kernel module implementing the ECHO function as example to compile and test? You could look at Johannes Berg 802.11 generic netlink implementation for a good example (net/wireless/nl80211.c in John Linville's tree): http://git.kernel.org/?p=linux/kernel/git/linville/wireless-dev.git;a=blob;f=net/wireless/nl80211.c;h=d6a44a386c2b86b81514b08d3c9b324dd2c7d229;hb=HEAD Again, I read in a message from Jamal Hadi Salim regarding Kernel -- User space Communication that: Essentially nothing new, Communication is as in standard netlink approach. i.e from user space you open a netlink socket to the kernel - in this case family NETLINK_GENERIC - and send and receive response as well as asynchronous events. To receive to events you subscribe to specific multicast groups. So I suppose I can modify a little my userland programs using old API in order to support this new API. Is that right? You probably want to use the libnl library. The latest SVN code has support for generic netlink: http://people.suug.ch/~tgr/libnl/ Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Generic netlink interface help
On 5/24/2007, Rodolfo Giometti [EMAIL PROTECTED] wrote: You probably want to use the libnl library. The latest SVN code has support for generic netlink: http://people.suug.ch/~tgr/libnl/ Regarding this issue I'd like to know if could be possible to avoid using this library... my LinuxPPS support is strictly relate with NTPD which doesn't use such library. It could be possible still using simple syscalls to access this new layer as for the old API? Yes it's possible, even though it could be more tedious and painful. Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] [-mm] ACPI: export ACPI events via netlink
On 5/22/2007, Zhang Rui [EMAIL PROTECTED] wrote: Index: linux-2.6.22-rc1/include/linux/netlink.h === --- linux-2.6.22-rc1.orig/include/linux/netlink.h 2007-05-21 10:19:00.0 +0800 +++ linux-2.6.22-rc1/include/linux/netlink.h 2007-05-21 15:26:14.0 +0800 @@ -24,6 +24,7 @@ /* leave room for NETLINK_DM (DM Events) */ #define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */ #define NETLINK_ECRYPTFS 19 +#define NETLINK_ACPI_EVENT20 /* acpi event notifications */ I think it is recommended to use the generic netlink layer instead of having everyone adding its own netlink ID. Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [IrDA] KingSun/DonShine USB IrDA dongle support
From: Alex Villac�s Lasso [EMAIL PROTECTED] This dongle does not follow the usb-irda specification, so it needs its own special driver. In addition, it uses interrupt endpoints instead of bulk ones as the rest of USB IrDA dongles supported by Linux (just to be different?) and data reads need to be parsed to extract the valid bytes before being unwrapped (details in the comment at the start of the source). No speed commands have been discovered for this dongle, and I suspect it does not have any at all. On plugin, this dongle reports vendor and device IDs: 0x07c0:0x4200 . The Windows driver that is used normally to control this dongle has a filename of DSIR620.SYS . Signed-off-by: Alex Villac�s Lasso [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/Kconfig | 14 + drivers/net/irda/Makefile |1 + drivers/net/irda/kingsun-sir.c | 657 3 files changed, 672 insertions(+), 0 deletions(-) create mode 100644 drivers/net/irda/kingsun-sir.c diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig index 7c8ccc0..9d28c75 100644 --- a/drivers/net/irda/Kconfig +++ b/drivers/net/irda/Kconfig @@ -141,6 +141,20 @@ config ACT200L_DONGLE To activate support for ACTiSYS IR-200L dongle you will have to start irattach like this: irattach -d act200l. +config KINGSUN_DONGLE + tristate KingSun/DonShine DS-620 IrDA-USB dongle + depends on IRDA USB EXPERIMENTAL + help + Say Y or M here if you want to build support for the KingSun/DonShine + DS-620 IrDA-USB bridge device driver. + + This USB bridge does not conform to the IrDA-USB device class + specification, and therefore needs its own specific driver. This + dongle supports SIR speed only (9600 bps). + + To compile it as a module, choose M here: the module will be called + kingsun-sir. + comment Old SIR device drivers config IRPORT_SIR diff --git a/drivers/net/irda/Makefile b/drivers/net/irda/Makefile index 5be09f1..233a2f9 100644 --- a/drivers/net/irda/Makefile +++ b/drivers/net/irda/Makefile @@ -45,6 +45,7 @@ obj-$(CONFIG_MCP2120_DONGLE) += mcp2120-sir.o obj-$(CONFIG_ACT200L_DONGLE) += act200l-sir.o obj-$(CONFIG_MA600_DONGLE) += ma600-sir.o obj-$(CONFIG_TOIM3232_DONGLE) += toim3232-sir.o +obj-$(CONFIG_KINGSUN_DONGLE) += kingsun-sir.o # The SIR helper module sir-dev-objs := sir_dev.o sir_dongle.o diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c new file mode 100644 index 000..a1eb130 --- /dev/null +++ b/drivers/net/irda/kingsun-sir.c @@ -0,0 +1,657 @@ +/* +* +* Filename: kingsun-sir.c +* Version: 0.1.1 +* Description: Irda KingSun/DonShine USB Dongle +* Status:Experimental +* Author:Alex Villac�s Lasso [EMAIL PROTECTED] +* +* Based on stir4200 and mcs7780 drivers, with (strange?) differences +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +*/ + +/* + * This is my current (2007-04-25) understanding of how this dongle is supposed + * to work. This is based on reverse-engineering and examination of the packet + * data sent and received by the WinXP driver using USBSnoopy. Feel free to + * update here as more of this dongle is known: + * + * General: Unlike the other USB IrDA dongles, this particular dongle exposes, + * not two bulk (in and out) endpoints, but two *interrupt* ones. This dongle, + * like the bulk based ones (stir4200.c and mcs7780.c), requires polling in + * order to receive data. + * Transmission: Just like stir4200, this dongle uses a raw stream of data, + * which needs to be wrapped and escaped in a similar way as in stir4200.c. + * Reception: Poll-based, as in stir4200. Each read returns the contents of a + * 8-byte buffer, of which the first byte (LSB) indicates the number of bytes + * (1-7) of valid data contained within the remaining 7 bytes. For example, if + * the buffer had the following contents: + * 06 ff ff ff c0 01 04 aa + * This means that (06) there are 6 bytes of valid data. The byte 0xaa at the + * end is garbage (left over from a previous reception
Re: [irda-users] [BUG] 2.6.20.1-rt8 irnet + pppd recursive spinlock...
On Mon, Apr 30, 2007 at 03:24:05PM +0200, Guennadi Liakhovetski wrote: On Tue, 10 Apr 2007, Samuel Ortiz wrote: Hi Guennadi, The patch below schedules irnet_flow_indication() asynchronously. Could you please give it a try (it builds, but I couldn't test it...) ? : Ok, your patch (still below) works too (now that I fixed that state machine race, btw, we still have to decide on the final form how it goes in the mainline) __after__ you also add the line + INIT_WORK(new-irnet_flow_work, irttp_flow_restart); in irttp_dup() (remember spinlock_init()?:-)), otherwise it oopses. good catch, again...Yes, I do remember the irttp_dup bug ;-) Generally, I like your patch better than mine to ppp_generic.c, where I explicitly check if a recursion is occurring. Still, I am a bit concerned about introducing yet another execution context into irda... We have seen a couple of locking issues there already in the last 2-3 months especially under rt-preempt... Would you be able to run some tests too? I think I can run some tests here as well, but probably not as many as you: I'm not doing IrDA stuff full time while it seems you currently are. But I will definitely spend some time this week running my IrDA stack with this patch applied. I didn't bother to do that earlier as you first reported some oops with this patch applied. I will be testing it too, but don't know how much longer and how intensively. Do you think we might get some new problems with this new context? It seems quite safe to me. But more importantly, I thing we do want to call the flow indication routine asynchronously in that specific case. There is one thing that this patch is missing though: we should probably clean the worqueue right before we destroy the TTP instance. The work routine checks for NULL pointer, but still... Cheers, Samuel. Thanks Guennadi diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h index a899e58..941f0f1 100644 --- a/include/net/irda/irttp.h +++ b/include/net/irda/irttp.h @@ -128,6 +128,7 @@ struct tsap_cb { struct net_device_stats stats; struct timer_list todo_timer; + struct work_struct irnet_flow_work; /* irttp asynchronous flow restart */ __u32 max_seg_size; /* Max data that fit into an IrLAP frame */ __u8 max_header_size; diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 7069e4a..a0d0f26 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -367,6 +367,29 @@ static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, /*** CLIENT CALLS ***/ /** LMP CALLBACKS **/ /* Everything is happily mixed up. Waiting for next clean up - Jean II */ +static void irttp_flow_restart(struct work_struct *work) +{ + struct tsap_cb * self = + container_of(work, struct tsap_cb, irnet_flow_work); + + if (self == NULL) + return; + + /* Check if we can accept more frames from client. */ + if ((self-tx_sdu_busy) + (skb_queue_len(self-tx_queue) TTP_TX_LOW_THRESHOLD) + (!self-close_pend)) { + if (self-notify.flow_indication) + self-notify.flow_indication(self-notify.instance, +self, FLOW_START); + + /* self-tx_sdu_busy is the state of the client. +* We don't really have a race here, but it's always safer +* to update our state after the client - Jean II */ + self-tx_sdu_busy = FALSE; + } +} + /* * Function irttp_open_tsap (stsap, notify) @@ -402,6 +425,8 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify) self-todo_timer.data = (unsigned long) self; self-todo_timer.function = irttp_todo_expired; + INIT_WORK(self-irnet_flow_work, irttp_flow_restart); + /* Initialize callbacks for IrLMP to use */ irda_notify_init(ttp_notify); ttp_notify.connect_confirm = irttp_connect_confirm; @@ -761,25 +786,10 @@ static void irttp_run_tx_queue(struct tsap_cb *self) self-stats.tx_packets++; } - /* Check if we can accept more frames from client. -* We don't want to wait until the todo timer to do that, and we -* can't use tasklets (grr...), so we are obliged to give control -* to client. That's ok, this test will be true not too often -* (max once per LAP window) and we are called from places -* where we can spend a bit of time doing stuff. - Jean II */ if ((self-tx_sdu_busy) (skb_queue_len(self-tx_queue) TTP_TX_LOW_THRESHOLD) (!self-close_pend)) - { - if (self-notify.flow_indication) - self-notify.flow_indication(self-notify.instance
Re: [patch 13/15] irda_device_dongle_init: fix kzalloc(GFP_KERNEL) in spinlock
On 4/26/2007, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: From: Andrew Morton [EMAIL PROTECTED] Fix http://bugzilla.kernel.org/show_bug.cgi?id=8343 Cc: Samuel Ortiz [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] This one was on my pipeline, looks good to me. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/irda_device.c | 21 - 1 file changed, 8 insertions(+), 13 deletions(-) diff -puN net/irda/irda_device.c~irda_device_dongle_init-fix-kzallocgfp_kernel-in-spinlock net/irda/irda_device.c --- a/net/irda/irda_device.c~irda_device_dongle_init-fix-kzallocgfp_kernel-in-spinlock +++ a/net/irda/irda_device.c @@ -375,7 +375,7 @@ EXPORT_SYMBOL(alloc_irdadev); dongle_t *irda_device_dongle_init(struct net_device *dev, int type) { struct dongle_reg *reg; - dongle_t *dongle = NULL; + dongle_t *dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL); might_sleep(); @@ -397,19 +397,14 @@ dongle_t *irda_device_dongle_init(struct if (!reg || !try_module_get(reg-owner) ) { IRDA_ERROR(IrDA: Unable to find requested dongle type %x\n, type); - goto out; + kfree(dongle); + dongle = NULL; + } + if (dongle) { + /* Bind the registration info to this particular instance */ + dongle-issue = reg; + dongle-dev = dev; } - - /* Allocate dongle info for this instance */ - dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL); - if (!dongle) - goto out; - - /* Bind the registration info to this particular instance */ - dongle-issue = reg; - dongle-dev = dev; - - out: spin_unlock(dongles-hb_spinlock); return dongle; } _ - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [PATCH 5/7] [IrDA] IrDA monitor mode
On Sat, Apr 21, 2007 at 10:46:00AM -0700, David Miller wrote: From: Samuel Ortiz [EMAIL PROTECTED] Date: Sat, 21 Apr 2007 14:42:40 +0300 I actually asked for your advice about it some time ago: http://marc.info/?l=linux-netdevm=117590341703544w=2 But by looking at the flow of emails on netdev sent to you (and that's only netdev...), I can easily see how you could have missed it :-) Regarding this patch, I came up with this ioctl because I thought implementing an IrDA netlink layer would be an overkill for just one single command. What I propose is that you revert this patch before we introduce a new ioctl upstream while I start implementing a netlink IrDA layer. Would that be ok with you, or can we let this new ioctl in and have it coexisting with a future netlink layer ? The only concern is that once we add the ioctl, we can't get rid of it, it's there forever. Please consider this very carefully. You might discover that once you create the IRDA netlink layer, you will find it convenient to make it support all the IRDA stack configuration not just this one thing :-) Fair enough, let's revert, and I'll come back to you with an IrDA netlink layer: --- This reverts commit 8eb943bbb8d2b59a5dccfed691da2e3797ef7e8e. Let's not introduce yet another ioctl. The IrDA monitoring feature will be implemented through the addition of an IrDA netlink layer. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- include/linux/irda.h |7 - include/net/irda/irlap.h |2 - net/irda/af_irda.c | 58 +- net/irda/irlap_frame.c |8 -- 4 files changed, 1 insertions(+), 74 deletions(-) diff --git a/include/linux/irda.h b/include/linux/irda.h index 1050f98..09d8f10 100644 --- a/include/linux/irda.h +++ b/include/linux/irda.h @@ -172,12 +172,6 @@ struct irda_ias_set { #define SIOCSDTRRTS(SIOCDEVPRIVATE + 8) #define SIOCGQOS (SIOCDEVPRIVATE + 9) -/* Protocol private ioctls */ -#define SIOCIRDASETMODE (SIOCPROTOPRIVATE + 0) -#define SIOCIRDAGETMODE (SIOCPROTOPRIVATE + 1) - -#define IRDA_MODE_MONITOR 0x1 - /* No reason to include linux/if.h just because of this one ;-) */ #define IRNAMSIZ 16 @@ -215,7 +209,6 @@ struct if_irda_req { } ifr_ifru; }; -#define ifr_name ifr_ifrn.ifrn_name #define ifr_baudrate ifr_ifru.ifru_qos.baudrate #define ifr_receiving ifr_ifru.ifru_receiving #define ifr_dongleifr_ifru.ifru_dongle diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h index 02b08d2..e77eb88 100644 --- a/include/net/irda/irlap.h +++ b/include/net/irda/irlap.h @@ -208,8 +208,6 @@ struct irlap_cb { intxbofs_delay; /* Nr of XBOF's used to MTT */ intbofs_count;/* Negotiated extra BOFs */ intnext_bofs; /* Negotiated extra BOFs after next frame */ - - intmode; /* 1 is for monitor mode (TX disabled) */ }; /* diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index b1aa951..06c97c6 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -49,6 +49,7 @@ #include linux/sockios.h #include linux/init.h #include linux/net.h +#include linux/irda.h #include linux/poll.h #include asm/ioctls.h/* TIOCOUTQ, TIOCINQ */ @@ -1743,7 +1744,6 @@ static unsigned int irda_poll(struct file * file, struct socket *sock, static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock-sk; - void __user *argp = (void __user *)arg; IRDA_DEBUG(4, %s(), cmd=%#x\n, __FUNCTION__, cmd); @@ -1785,62 +1785,6 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case SIOCGIFMETRIC: case SIOCSIFMETRIC: return -EINVAL; - - case SIOCIRDASETMODE: { - struct if_irda_req if_irda; - struct net_device * dev; - struct irlap_cb * irlap; - - if (!capable(CAP_NET_ADMIN)) - return -EPERM; - - if (copy_from_user(if_irda, argp, sizeof(struct if_irda_req))) - return -EFAULT; - - dev = dev_get_by_name(if_irda.ifr_name); - if (!dev) - return -ENODEV; - - irlap = (struct irlap_cb *)dev-atalk_ptr; - if (!irlap) - return -ENODEV; - - IRDA_DEBUG(4, %s(): Setting %s to 0x%x\n, __FUNCTION__, - dev-name, if_irda.ifr_mode); - - irlap-mode = if_irda.ifr_mode; - - dev_put(dev); - - break; - } - case SIOCIRDAGETMODE: { - struct if_irda_req if_irda; - struct net_device * dev; - struct irlap_cb * irlap; - - if (copy_from_user(if_irda, argp, sizeof(struct if_irda_req))) - return -EFAULT; - - dev = dev_get_by_name
Re: [irda-users] [PATCH 5/7] [IrDA] IrDA monitor mode
Hi Dave, On Fri, Apr 20, 2007 at 10:11:43PM -0700, David Miller wrote: From: [EMAIL PROTECTED] Date: Thu, 19 Apr 2007 00:32:07 +0300 Through a protocol specific ioctl, one can disable IrDA TX in order to monitor an IrDA link. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] I'd really rather see IRDA use netlink instead of these wonky ioctls, but whatever, if you want to put this dirty into your stack and you're the maintainer I can't really stop you :-) I actually asked for your advice about it some time ago: http://marc.info/?l=linux-netdevm=117590341703544w=2 But by looking at the flow of emails on netdev sent to you (and that's only netdev...), I can easily see how you could have missed it :-) Regarding this patch, I came up with this ioctl because I thought implementing an IrDA netlink layer would be an overkill for just one single command. What I propose is that you revert this patch before we introduce a new ioctl upstream while I start implementing a netlink IrDA layer. Would that be ok with you, or can we let this new ioctl in and have it coexisting with a future netlink layer ? Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [PATCH 2/7] [IrDA] af_irda: Silence kernel message in irda_recvmsg_stream
On Fri, Apr 20, 2007 at 10:09:00PM -0700, David Miller wrote: There were some conflicts in this one wrt. the sock_orphan() bug fix we put into mainline recently, but I did my best to resolve it when I applied this to net-2.6.22 You can have a look and verify things when I put up my net-2.6.2 tree later this evening. Verified. It's all good, thanks a lot. Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] [net-2.6] IrDA: Correctly handling socket error
From: Olaf Kirch [EMAIL PROTECTED] This patch fixes an oops first reported in mid 2006 - see http://lkml.org/lkml/2006/8/29/358 The cause of this bug report is that when an error is signalled on the socket, irda_recvmsg_stream returns without removing a local wait_queue variable from the socket's sk_sleep queue. This causes havoc further down the road. In response to this problem, a patch was made that invoked sock_orphan on the socket when receiving a disconnect indication. This is not a good fix, as this sets sk_sleep to NULL, causing applications sleeping in recvmsg (and other places) to oops. This is against the latest net-2.6 and should be considered for -stable inclusion. Signed-off-by: Olaf Kirch [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/af_irda.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index f9b15d4..bf994c8 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -138,7 +138,6 @@ static void irda_disconnect_indication(void *instance, void *sap, sk-sk_shutdown |= SEND_SHUTDOWN; sk-sk_state_change(sk); - sock_orphan(sk); release_sock(sk); /* Close our TSAP. @@ -1445,7 +1444,7 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, */ ret = sock_error(sk); if (ret) - break; + ; else if (sk-sk_shutdown RCV_SHUTDOWN) ; else if (noblock) -- 1.5.1 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [BUG] 2.6.20.1-rt8 irnet + pppd recursive spinlock...
Hi Guennadi, On Sat, Apr 07, 2007 at 03:59:26AM +0300, Samuel Ortiz wrote: IMHO, irnet_flow_indication() should be called asynchronously by irttp_run_tx_queue(), through some bottom-half mechanism. That would fix your locking issues, and that would reduce the time we spend in the IrDA code with this lock taken. I will try to come up with some patches for you later this weekend. The patch below schedules irnet_flow_indication() asynchronously. Could you please give it a try (it builds, but I couldn't test it...) ? : diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h index a899e58..941f0f1 100644 --- a/include/net/irda/irttp.h +++ b/include/net/irda/irttp.h @@ -128,6 +128,7 @@ struct tsap_cb { struct net_device_stats stats; struct timer_list todo_timer; + struct work_struct irnet_flow_work; /* irttp asynchronous flow restart */ __u32 max_seg_size; /* Max data that fit into an IrLAP frame */ __u8 max_header_size; diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 7069e4a..a0d0f26 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c @@ -367,6 +367,29 @@ static int irttp_param_max_sdu_size(void *instance, irda_param_t *param, /*** CLIENT CALLS ***/ /** LMP CALLBACKS **/ /* Everything is happily mixed up. Waiting for next clean up - Jean II */ +static void irttp_flow_restart(struct work_struct *work) +{ + struct tsap_cb * self = + container_of(work, struct tsap_cb, irnet_flow_work); + + if (self == NULL) + return; + + /* Check if we can accept more frames from client. */ + if ((self-tx_sdu_busy) + (skb_queue_len(self-tx_queue) TTP_TX_LOW_THRESHOLD) + (!self-close_pend)) { + if (self-notify.flow_indication) + self-notify.flow_indication(self-notify.instance, +self, FLOW_START); + + /* self-tx_sdu_busy is the state of the client. +* We don't really have a race here, but it's always safer +* to update our state after the client - Jean II */ + self-tx_sdu_busy = FALSE; + } +} + /* * Function irttp_open_tsap (stsap, notify) @@ -402,6 +425,8 @@ struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify) self-todo_timer.data = (unsigned long) self; self-todo_timer.function = irttp_todo_expired; + INIT_WORK(self-irnet_flow_work, irttp_flow_restart); + /* Initialize callbacks for IrLMP to use */ irda_notify_init(ttp_notify); ttp_notify.connect_confirm = irttp_connect_confirm; @@ -761,25 +786,10 @@ static void irttp_run_tx_queue(struct tsap_cb *self) self-stats.tx_packets++; } - /* Check if we can accept more frames from client. -* We don't want to wait until the todo timer to do that, and we -* can't use tasklets (grr...), so we are obliged to give control -* to client. That's ok, this test will be true not too often -* (max once per LAP window) and we are called from places -* where we can spend a bit of time doing stuff. - Jean II */ if ((self-tx_sdu_busy) (skb_queue_len(self-tx_queue) TTP_TX_LOW_THRESHOLD) (!self-close_pend)) - { - if (self-notify.flow_indication) - self-notify.flow_indication(self-notify.instance, -self, FLOW_START); - - /* self-tx_sdu_busy is the state of the client. -* We don't really have a race here, but it's always safer -* to update our state after the client - Jean II */ - self-tx_sdu_busy = FALSE; - } + schedule_work(self-irnet_flow_work); /* Reset lock */ self-tx_queue_lock = 0; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] [net-2.6.22] IrDA: IrLAP raw mode
On Fri, Mar 16, 2007 at 08:34:51PM -0700, David Miller wrote: From: Samuel Ortiz [EMAIL PROTECTED] Date: Sat, 17 Mar 2007 03:57:29 +0200 This patch allows us to bypass the IrDA stack down to the IrLAP level. Sending and receiving frames is done through a character device. This is useful for e.g. doing real IrDA sniffing, testing external IrDA stacks and for Lirc (once I will add the framing disabling switch). Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] I understand the idea, but I fail to see any reason this should not be done with sockets. Everywhere else we provide this kind of functionality it is either with netlink (nf_queue etc.) or raw sockets of some kind (AF_INET/SOCK_RAW, AF_PACKET, etc.) Therefore IRDA should really provide this facility in some similar manner. I definitely agree here. Actually, you can already sniff IrDA packets through an AF_PACKET socket, that's what irdadump does. My patch was useless, forget about it... I have a question though: On top of the regular IrDA sniffing done with a simple AF_PACKET socket, I also would like to be able to disable TX at the IrLAP level (typically, this would allow an IrDA device to listen to all the packets from an IrDA link without being noticed by the other devices). I was thinking of adding a protocol private ioctl (as in SIOCPROTOPRIVATE) to let userspace toggle an IrLAP flag (one per IrLAP instance) that would disable a specific IrDA device TX path. Would that be an acceptable solution, or would you rather see a netlink socket for that purpose ? Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [BUG] 2.6.20.1-rt8 irnet + pppd recursive spinlock...
Hi Guennadi, On Thu, Apr 05, 2007 at 12:59:40PM +0200, Guennadi Liakhovetski wrote: Ok, a simple analysis reveals the recursive spinlock: On Thu, 5 Apr 2007, Guennadi Liakhovetski wrote: [bf12b220] (ppp_channel_push+0x0/0xc8 [ppp_generic]) from [bf12bf98] (ppp_output_wakeup+0x18/0x1c [ppp_generic]) === r7 = C38F42BC r6 = C38F4200 r5 = C38F4200 r4 = === spin_lock_bh(pch-downl); [bf12bf80] (ppp_output_wakeup+0x0/0x1c [ppp_generic]) from [bf132c98] (irnet_flow_indication+0x38/0x3c [irnet]) [bf132c60] (irnet_flow_indication+0x0/0x3c [irnet]) from [bf104e4c] (irttp_run_tx_queue+0x1c0/0x1d4 [irda]) [bf104c8c] (irttp_run_tx_queue+0x0/0x1d4 [irda]) from [bf104f88] (irttp_data_request+0x128/0x4f8 [irda]) r8 = BF121560 r7 = 0002 r6 = C38F4200 r5 = C21418B8 r4 = C21418B8 [bf104e60] (irttp_data_request+0x0/0x4f8 [irda]) from [bf1321bc] (ppp_irnet_send+0x134/0x238 [irnet]) [bf132088] (ppp_irnet_send+0x0/0x238 [irnet]) from [bf12a600] (ppp_push+0x80/0xb8 [ppp_generic]) r7 = C3A436E0 r6 = r5 = C21418B8 r4 = C1489600 [bf12a580] (ppp_push+0x0/0xb8 [ppp_generic]) from [bf12a8d8] (ppp_xmit_process+0x34/0x50c [ppp_generic]) === r7 = 0021 r6 = C21418B8 r5 = C1489600 r4 = === spin_lock_bh(pch-downl); [bf12a8a4] (ppp_xmit_process+0x0/0x50c [ppp_generic]) from [bf12aed8] (ppp_start_xmit+0x128/0x254 [ppp_generic]) [bf12adb0] (ppp_start_xmit+0x0/0x254 [ppp_generic]) from [c0186fa4] (dev_hard_start_xmit+0x170/0x268) [c0186e34] (dev_hard_start_xmit+0x0/0x268) from [c01979b8] (__qdisc_run+0x60/0x270) r8 = C1BBC914 r7 = C21418B8 r6 = r5 = C21418B8 r4 = C1BBC800 [c0197958] (__qdisc_run+0x0/0x270) from [c0187250] (dev_queue_xmit+0x1b4/0x25c) Now, does anyone have an idea how best to fix it? 1. Should re-entrance in ppp_channel_push() be prevented, and if yes - at which level? Or 2. Should re-entrance be allowed and only recursive spin_lock_bh() avoided? IMHO, irnet_flow_indication() should be called asynchronously by irttp_run_tx_queue(), through some bottom-half mechanism. That would fix your locking issues, and that would reduce the time we spend in the IrDA code with this lock taken. I will try to come up with some patches for you later this weekend. Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [git patches] net driver fixes
On 3/30/2007, Guennadi Liakhovetski [EMAIL PROTECTED] wrote: On Thu, 29 Mar 2007, Jeff Garzik wrote: Guennadi Liakhovetski wrote: Jeff, might be worth getting the sk_buff leak fix in ppp from http://www.spinics.net/lists/netdev/msg27706.html in 2.6.21 too? Don't know how important it is for stable. It was present in 2.6.18 too. Can you resend the patch to me, please? Easier for the system to apply than the URL... Sure, attached below. I think, though, this patch is already in someone's tree. Andrew has applied it to -mm under the name ppp-dont-leak-an-sk_buff-on-interface-destruction.patch but then dropped with the reasoning This patch was dropped because it was merged into mainline or a subsystem tree. So, maybe it is now in Samuel's IrDA tree. Samuel?So, maybe all you have to do is to pull it from his tree. It's already in Linus tree, and has landed there through davem's net-2.6 tree. So, this is all taken care of, Jeff doesn't need to worry about this one. Cheers, Samuel. Thanks Guennadi - Guennadi Liakhovetski, Ph.D. DSA Daten- und Systemtechnik GmbH Pascalstr. 28 D-52076 Aachen Germany Don't leak an sk_buff on interface destruction. Signed-off-by: G. Liakhovetski [EMAIL PROTECTED] --- a/drivers/net/ppp_generic.c2007-03-23 13:04:04.0 +0100 +++ b/drivers/net/ppp_generic.c2007-03-23 13:05:29.0 +0100 @@ -2544,6 +2544,9 @@ ppp-active_filter = NULL; #endif /* CONFIG_PPP_FILTER */ + if (ppp-xmit_pending) + kfree_skb(ppp-xmit_pending); + kfree(ppp); } - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [2.6.20-rt8] Neighbour table overflow.
On Sat, Mar 24, 2007 at 10:10:34PM -0700, David Miller wrote: From: Guennadi Liakhovetski [EMAIL PROTECTED] Date: Fri, 23 Mar 2007 13:14:43 +0100 (CET) On Wed, 21 Mar 2007, Guennadi Liakhovetski wrote: On Wed, 21 Mar 2007, Samuel Ortiz wrote: I'm quite sure the leak is in the IrDA code rather than in the ppp or ipv4 one, hence the need for full irda debug... Well, looks like you were wrong, Samuel. Below is a patch that fixes ONE sk_buff leak (maintainer added to cc: hi, Paul:-)). Still investigating if there are more there. This is strange. The PPP generic layer seems to be very careful about it's handling of the -xmit_pending packet. When a packet is added to -xmit_pending, immediately ppp_push() is called, and ppp_push() gives the packet to the channels xmit function, and unless the xmit function returns zero the -xmit_pending is reset to NULL because non-zero return from the channel xmit functions means that the driver took the packet. Now I checked irnet_ppp.c, which is the driver under scrutiny here, and it never ever returns zero, under any circumstance, it always return one. So the -xmit_pending should always be NULL'd out by ppp_push(). There is some funny BLOCK_WHEN_CONNECT code, which will return 0 in certain cases, but that define it never set during the build. Nevermind... that code does get enabled. :( It is enabled, yes, from net/irda/irnet/irnet.h It seems Jean added this option to make the connectdelay 0 pppd option working. This looks like it might be a bug, perhaps you can only return zero from the transmit function when your queue really is full and you plan to wake things up properly when space appears (via ppp_output_wakeup()). You can't return 0 because of an event which might never occur, that's what makes -xmit_pending get stuck and leak. I still think Guennadi's fix is correct even if you return 0 from the TX function only when you're running out of space. If we unregister the ppp interface before we get a chance to call ppp_output_wake(), then we'll leak an xmit_pending skb. I guess Paul will decide here. If he rejects Guennadi's patch, I'll come up with some IrDA patch so that we free our pending skb from the irnet code, or try somehow not to block the PPP tx queue while connecting. Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [2.6.20-rt8] Neighbour table overflow.
On Fri, Mar 23, 2007 at 01:14:43PM +0100, Guennadi Liakhovetski wrote: On Wed, 21 Mar 2007, Guennadi Liakhovetski wrote: On Wed, 21 Mar 2007, Samuel Ortiz wrote: I'm quite sure the leak is in the IrDA code rather than in the ppp or ipv4 one, hence the need for full irda debug... Well, looks like you were wrong, Samuel. Heh, it's good to be wrong sometimes :-) Below is a patch that fixes ONE sk_buff leak (maintainer added to cc: hi, Paul:-)). Still investigating if there are more there. Are you still seeing the skb cache growing with your fix ? Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [2.6.20-rt8] Neighbour table overflow.
On 3/21/2007, Guennadi Liakhovetski [EMAIL PROTECTED] wrote: (Short recap for newly added to cc: netdev: I'm seeing an skb leak in 2.6.20 during an IrDA IrNET+ppp UDP test with periodic connection disruptions) On Wed, 21 Mar 2007, Guennadi Liakhovetski wrote: On Tue, 20 Mar 2007, Guennadi Liakhovetski wrote: Ok, looks like all leaked skbuffs come from ip_append_data(), like this: (sock_alloc_send_skb+0x2c8/0x2e4) (ip_append_data+0x7fc/0xa80) (udp_sendmsg+0x248/0x68c) (inet_sendmsg+0x60/0x64) (sock_sendmsg+0xb4/0xe4) r4 = C3CB4960 (sys_sendto+0xc8/0xf0) r4 = (sys_socketcall+0x168/0x1f0) (ret_fast_syscall+0x0/0x2c) This call to sock_alloc_send_skb() in ip_append_data() is not from the inlined ip_ufo_append_data(), it is here: /* The last fragment gets additional space at tail. * Note, with MSG_MORE we overallocate on fragments, * because we have no idea what fragment will be * the last. */ if (datalen == length + fraggap) alloclen += rt-u.dst.trailer_len; if (transhdrlen) { skb = sock_alloc_send_skb(sk, alloclen + hh_len + 15, (flags MSG_DONTWAIT), err); } else { Then, I traced a couple of paths how such a skbuff, coming down from ip_append_data() and allocated above get freed (when they do): [c0182380] (__kfree_skb+0x0/0x170) from [c0182514] (kfree_skb+0x24/0x50) r5 = C332BC00 r4 = C332BC00 [c01824f0] (kfree_skb+0x0/0x50) from [bf0fac58] (irlap_update_nr_received+0x94/0xc8 [irda]) [bf0fabc4] (irlap_update_nr_received+0x0/0xc8 [irda]) from [bf0fda98] (irlap_state_nrm_p+0x530/0x7c0 [irda]) r7 = 0001 r6 = C0367EC0 r5 = C332BC00 r4 = [bf0fd568] (irlap_state_nrm_p+0x0/0x7c0 [irda]) from [bf0fbd90] (irlap_do_event+0x68/0x18c [irda]) [bf0fbd28] (irlap_do_event+0x0/0x18c [irda]) from [bf1008cc] (irlap_driver_rcv+0x1f0/0xd38 [irda]) [bf1006dc] (irlap_driver_rcv+0x0/0xd38 [irda]) from [c01892c0] (netif_receive_skb+0x244/0x338) [c018907c] (netif_receive_skb+0x0/0x338) from [c0189468] (process_backlog+0xb4/0x194) [c01893b4] (process_backlog+0x0/0x194) from [c01895f8] (net_rx_action+0xb0/0x210) [c0189548] (net_rx_action+0x0/0x210) from [c0042f7c] (ksoftirqd+0x108/0x1cc) [c0042e74] (ksoftirqd+0x0/0x1cc) from [c0053614] (kthread+0x10c/0x138) [c0053508] (kthread+0x0/0x138) from [c003f918] (do_exit+0x0/0x8b0) r8 = r7 = r6 = r5 = r4 = This is the IrDA RX path, so I doubt the corresponding skb ever got through ip_append_data(). The skb was allocated by your HW driver upon packet reception, then queued to the net input queue, and finally passed to the IrDA stack. Are you sure your tracing is correct ? and [c0182380] (__kfree_skb+0x0/0x170) from [c0182514] (kfree_skb+0x24/0x50) r5 = C03909E0 r4 = C1A97400 [c01824f0] (kfree_skb+0x0/0x50) from [c0199bf8] (pfifo_fast_enqueue+0xb4/0xd0) [c0199b44] (pfifo_fast_enqueue+0x0/0xd0) from [c0188c30] (dev_queue_xmit+0x17c/0x25c) r8 = C1A2DCE0 r7 = FFF4 r6 = C3393114 r5 = C03909E0 r4 = C3393000 [c0188ab4] (dev_queue_xmit+0x0/0x25c) from [c01a7c18] (ip_output+0x150/0x254) r7 = C3717120 r6 = C03909E0 r5 = r4 = C1A2DCE0 [c01a7ac8] (ip_output+0x0/0x254) from [c01a93d0] (ip_push_pending_frames+0x368/0x4d4) [c01a9068] (ip_push_pending_frames+0x0/0x4d4) from [c01c6954] (udp_push_pending_frames+0x14c/0x310) [c01c6808] (udp_push_pending_frames+0x0/0x310) from [c01c70d8] (udp_sendmsg+0x5c0/0x690) [c01c6b18] (udp_sendmsg+0x0/0x690) from [c01ceafc] (inet_sendmsg+0x60/0x64) [c01cea9c] (inet_sendmsg+0x0/0x64) from [c017c970] (sock_sendmsg+0xb4/0xe4) r7 = C2CEFDF4 r6 = 0064 r5 = C2CEFEA8 r4 = C3C94080 [c017c8bc] (sock_sendmsg+0x0/0xe4) from [c017dd9c] (sys_sendto+0xc8/0xf0) r7 = 0064 r6 = C3571580 r5 = C2CEFEC4 r4 = [c017dcd4] (sys_sendto+0x0/0xf0) from [c017e654] (sys_socketcall+0x168/0x1f0) [c017e4ec] (sys_socketcall+0x0/0x1f0) from [c001ff40] (ret_fast_syscall+0x0/0x2c) r5 = 00415344 r4 = This one is on the TX path, yes. However it got dropped and freed because your TX queue was full. Any idea in which situation does that happen ? I would be greatful for any hints how I can identify which skbuff's get lost and why, and where and who should free them. You're seeing skb leaks when cutting the ppp connection periodically, right ? Do you such leaks when not cutting the ppp connection ? If not, could you send me a kernel trace (with irda debug set to 5) when the ppp connection is shut down ? It would narrow down the problem a bit. I'm quite sure the leak is in the IrDA code rather than in the ppp or ipv4 one, hence the need for full irda debug... Cheers, Samuel. I am not
Re: [PATCH 3/6] IrDA: IrLAP raw mode
Hi Ingo, On Fri, Mar 16, 2007 at 11:02:04AM +0100, Ingo Oeser wrote: --- /dev/null +++ b/include/net/irda/irlap_raw.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2007 Samuel Ortiz ([EMAIL PROTECTED]) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, version 2. + * + */ + +#ifndef _IRLAP_RAW_H +#define _IRLAP_RAW_H + +#ifdef CONFIG_IRDA_RAW + +int irlap_raw_recv_frame(struct sk_buff *skb, struct net_device *dev); +int irlap_raw_register_device(struct net_device * dev); +int irlap_raw_unregister_device(struct net_device * dev); + +#else + +#define irlap_raw_recv_frame(skbuff, netdev) +#define irlap_raw_register_device(netdev) +#define irlap_raw_unregister_device(netdev) This stuff is usually done this way (functions, which just check arguments and do nothing): Since those are exported symbols, I think it makes sense to do these checks. I would suggest a small helper function here, which compiles into a constant, if raw_mode is not compiled in. like This would prevent us from adding #ifdefs in the core IrDA code: I'll go for it. Thanks for the comments. Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] [net-2.6] IrDA: Delay needed when uploading firmware chunks
With 42101001.sb firmwares, we need a 10 ms delay between firmware chunks upload on irda-usb. Patch from Nigel Williams [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/irda-usb.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 340ee99..1d510bd 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -1057,6 +1057,8 @@ static int stir421x_fw_upload(struct irda_usb_cb *self, if (ret 0) break; + + mdelay(10); } kfree(patch_block); -- 1.5.0.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/4] [net-2.6.22] IrDA: IrLAP raw mode
This patch allows us to bypass the IrDA stack down to the IrLAP level. Sending and receiving frames is done through a character device. This is useful for e.g. doing real IrDA sniffing, testing external IrDA stacks and for Lirc (once I will add the framing disabling switch). Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- include/net/irda/irlap.h |5 + include/net/irda/irlap_raw.h | 57 +++ net/irda/Kconfig | 10 ++ net/irda/Makefile|1 + net/irda/irlap.c |5 + net/irda/irlap_event.c |3 + net/irda/irlap_frame.c |4 + net/irda/irlap_raw.c | 358 ++ net/irda/irsysctl.c | 16 ++- 9 files changed, 458 insertions(+), 1 deletions(-) create mode 100644 include/net/irda/irlap_raw.h create mode 100644 net/irda/irlap_raw.c diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h index e77eb88..1b24cfc 100644 --- a/include/net/irda/irlap.h +++ b/include/net/irda/irlap.h @@ -36,6 +36,7 @@ #include net/irda/qos.h /* struct qos_info */ #include net/irda/discovery.h/* discovery_t */ #include net/irda/irlap_event.h /* IRLAP_STATE, ... */ +#include net/irda/irlap_raw.h/* IRLAP raw definitions */ #include net/irda/irmod.h/* struct notify_t */ #define CONFIG_IRDA_DYNAMIC_WINDOW 1 @@ -208,6 +209,10 @@ struct irlap_cb { intxbofs_delay; /* Nr of XBOF's used to MTT */ intbofs_count;/* Negotiated extra BOFs */ intnext_bofs; /* Negotiated extra BOFs after next frame */ +#ifdef CONFIG_IRDA_RAW + intraw_mode; + struct irlap_raw * irlap_raw; +#endif }; /* diff --git a/include/net/irda/irlap_raw.h b/include/net/irda/irlap_raw.h new file mode 100644 index 000..ce90563 --- /dev/null +++ b/include/net/irda/irlap_raw.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2007 Samuel Ortiz ([EMAIL PROTECTED]) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, version 2. + * + */ + +#ifndef _IRLAP_RAW_H +#define _IRLAP_RAW_H + +struct irlap_cb; + +#ifdef CONFIG_IRDA_RAW + +extern int irlap_raw_recv_frame(struct sk_buff *skb, struct net_device *dev); +extern int irlap_raw_register_device(struct net_device * dev); +extern int irlap_raw_unregister_device(struct net_device * dev); +extern int irlap_raw_mode(struct irlap_cb *self); + +#else + +static inline int irlap_raw_recv_frame(struct sk_buff *skb, + struct net_device *dev) +{ +if (skb == NULL) +return -EINVAL; + +if (dev-atalk_ptr == NULL) +return -ENODEV; + +return 0; +} + +static inline int irlap_raw_register_device(struct net_device * dev) +{ +if (dev == NULL) +return -ENODEV; +return 0; +} + +static inline int irlap_raw_unregister_device(struct net_device * dev) +{ +if (dev == NULL) +return -ENODEV; +return 0; +} + +static inline int irlap_raw_mode(struct irlap_cb *self) +{ +return 0; +} + +#endif + +#endif diff --git a/net/irda/Kconfig b/net/irda/Kconfig index 9efb17b..310a036 100644 --- a/net/irda/Kconfig +++ b/net/irda/Kconfig @@ -92,5 +92,15 @@ config IRDA_DEBUG If unsure, say Y (since it makes it easier to find the bugs). +config IRDA_RAW + bool IrLAP raw + depends on IRDA + help + Say Y if you want to bypass the IrDA stack, down to the IrLAP level. + This option allows you to send and receive IrLAP frames from + userspace, by writing and reading to a character device + (/dev/irdaX_raw). Note that the IrDA stack will be mostly disabled. + If unsure, say N. + source drivers/net/irda/Kconfig diff --git a/net/irda/Makefile b/net/irda/Makefile index d1366c2..11d5ffb 100644 --- a/net/irda/Makefile +++ b/net/irda/Makefile @@ -13,3 +13,4 @@ irda-y := iriap.o iriap_event.o irlmp.o irlmp_event.o irlmp_frame.o \ discovery.o parameters.o irmod.o irda-$(CONFIG_PROC_FS) += irproc.o irda-$(CONFIG_SYSCTL) += irsysctl.o +irda-$(CONFIG_IRDA_RAW) += irlap_raw.o diff --git a/net/irda/irlap.c b/net/irda/irlap.c index d93ebd1..656c949 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c @@ -173,6 +173,8 @@ struct irlap_cb *irlap_open(struct net_device *dev, struct qos_info *qos, irlmp_register_link(self, self-saddr, self-notify); + irlap_raw_register_device(dev); + return self; } EXPORT_SYMBOL(irlap_open); @@ -234,6 +236,9 @@ void irlap_close(struct irlap_cb *self) IRDA_DEBUG(1, %s(), Didn't find myself!\n, __FUNCTION__); return; } + + irlap_raw_unregister_device(self-netdev); + __irlap_close(lap); } EXPORT_SYMBOL(irlap_close); diff --git a/net/irda/irlap_event.c
[PATCH 2/4] [net-2.6.22] IrDA: removing stir4200 useless include
stir4200 doesn't need to include irlap.h Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/stir4200.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index a22175f..aec86a2 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c @@ -52,7 +52,6 @@ #include linux/kthread.h #include linux/freezer.h #include net/irda/irda.h -#include net/irda/irlap.h #include net/irda/irda_device.h #include net/irda/wrapper.h #include net/irda/crc.h -- 1.5.0.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] [net-2.6.22] IrDA: irda lockdep annotation
Rmmoding irda triggers a lockdep false positive. Reported-by: Dave Jones [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/irqueue.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c index 9266233..d058b46 100644 --- a/net/irda/irqueue.c +++ b/net/irda/irqueue.c @@ -384,6 +384,9 @@ EXPORT_SYMBOL(hashbin_new); *for deallocating this structure if it's complex. If not the user can *just supply kfree, which should take care of the job. */ +#ifdef CONFIG_LOCKDEP +static int hashbin_lock_depth = 0; +#endif int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) { irda_queue_t* queue; @@ -395,7 +398,8 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) /* Synchronize */ if ( hashbin-hb_type HB_LOCK ) { - spin_lock_irqsave(hashbin-hb_spinlock, flags); + spin_lock_irqsave_nested(hashbin-hb_spinlock, flags, +hashbin_lock_depth++); } /* @@ -419,6 +423,9 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) /* Release lock */ if ( hashbin-hb_type HB_LOCK) { spin_unlock_irqrestore(hashbin-hb_spinlock, flags); +#ifdef CONFIG_LOCKDEP + hashbin_lock_depth--; +#endif } /* -- 1.5.0.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] [net-2.6] IrDA: Calling ppp_unregister_channel() from process context
We need to call ppp_unregister_channel() when IrNET disconnects, and this must be done from a process context. Bug reported and patch tested by Guennadi Liakhovetski. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/irnet/irnet.h |2 +- net/irda/irnet/irnet_irda.c | 34 +- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h index 873ae18..bc2e15c 100644 --- a/net/irda/irnet/irnet.h +++ b/net/irda/irnet/irnet.h @@ -419,7 +419,7 @@ typedef struct irnet_socket u32 raccm; /* to please pppd - dummy) */ unsigned int flags; /* PPP flags (compression, ...) */ unsigned int rbits; /* Unused receive flags ??? */ - + struct work_struct disconnect_work; /* Process context disconnection */ /* IrTTP part */ /* We create a pseudo socket over the IrDA tranport */ unsigned longttp_open; /* Set when IrTTP is ready */ diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c index c378e66..a4f1439 100644 --- a/net/irda/irnet/irnet_irda.c +++ b/net/irda/irnet/irnet_irda.c @@ -10,6 +10,27 @@ #include irnet_irda.h/* Private header */ +/* + * PPP disconnect work: we need to make sure we're in + * process context when calling ppp_unregister_channel(). + */ +static void irnet_ppp_disconnect(struct work_struct *work) +{ + irnet_socket * self = + container_of(work, irnet_socket, disconnect_work); + + if (self == NULL) + return; + /* +* If we were connected, cleanup close the PPP +* channel, which will kill pppd (hangup) and the rest. +*/ + if (self-ppp_open !self-ttp_open !self-ttp_connect) { + ppp_unregister_channel(self-chan); + self-ppp_open = 0; + } +} + /* CONTROL CHANNEL */ /* * When ppp is not active, /dev/irnet act as a control channel. @@ -499,6 +520,8 @@ irda_irnet_create(irnet_socket *self) #endif /* DISCOVERY_NOMASK */ self-tx_flow = FLOW_START; /* Flow control from IrTTP */ + INIT_WORK(self-disconnect_work, irnet_ppp_disconnect); + DEXIT(IRDA_SOCK_TRACE, \n); return(0); } @@ -1134,15 +1157,8 @@ irnet_disconnect_indication(void * instance, { if(test_open) { -#ifdef MISSING_PPP_API - /* ppp_unregister_channel() wants a user context, which we - * are guaranteed to NOT have here. What are we supposed - * to do here ? Jean II */ - /* If we were connected, cleanup close the PPP channel, - * which will kill pppd (hangup) and the rest */ - ppp_unregister_channel(self-chan); - self-ppp_open = 0; -#endif + /* ppp_unregister_channel() wants a user context. */ + schedule_work(self-disconnect_work); } else { -- 1.5.0.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] [net-2.6.22] IrDA: SMC SuperIO Chip LPC47N227 not identified properly
SMC SuperIO Chip LPC47N227 used for IrDA is not detected because its device identification byte can be 0x7A instead of 0x5A. Patch from Peter Kovar [EMAIL PROTECTED] Cc: Jean Delvare [EMAIL PROTECTED] Signed-off-by: Andrew Morton [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/smsc-ircc2.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 103a2d1..e845386 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c @@ -315,6 +315,7 @@ static struct smsc_chip __initdata lpc_chips_flat[] = { /* Base address 0x2E or 0x4E */ { 47N227, KEY55_1|FIR|SERx4, 0x5a, 0x00 }, + { 47N227, KEY55_1|FIR|SERx4, 0x7a, 0x00 }, { 47N267, KEY55_1|FIR|SERx4, 0x5e, 0x00 }, { NULL } }; -- 1.5.0.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/6] IrDA: Updates
On Thu, Mar 15, 2007 at 03:00:54AM -0700, David Miller wrote: From: Samuel Ortiz [EMAIL PROTECTED] Date: Wed, 14 Mar 2007 21:22:36 +0200 Some IrDA updates: - IrNET identation and bug fix. (patches 1 and 2) - IrLAP raw mode initial implementation. (patch 3) - stir4200 and irda-usb fixes. (patches 4 and 5) - hashbin lockdep fixes. (patch 6) Indentation and coding-style cleanups are not appropriate for 2.6.21, so I need to ask you which of these changes you need to get into 2.6.21 and which can go into the non-bug-fix 2.6.22 bound tree? When you submit a mish-mash of cleanups and real bug fixes, it makes life extremely difficult for me, that's why I totally abandoned even looking at this today until right before going to sleep. I understand that, sorry about it. Please properly segregate things in the future and make sure that you submit bug fixes against net-2.6 and features against the net-2.6.22 tree. I will resend 2 separate patch sets by tomorrow, forget about this one. Thanks for your patience. Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/6] IrDA: Updates
Hi Dave, Some IrDA updates: - IrNET identation and bug fix. (patches 1 and 2) - IrLAP raw mode initial implementation. (patch 3) - stir4200 and irda-usb fixes. (patches 4 and 5) - hashbin lockdep fixes. (patch 6) Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/6] IrDA: Process context ppp_unregister_channel() call
We need to call ppp_unregister_channel() when IrNET disconnects, and this must be done from a process context. This patch applies on top of [PATCH 1/7] IrDA: IrNET code indentation. Also, this is a bug fix, certainly not a critical one. Should I forward it to [EMAIL PROTECTED] though ? Patch tested by Guennadi Liakhovetski. Reported-by: Guennadi Liakhovetski [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- net/irda/irnet/irnet.h |1 + net/irda/irnet/irnet_irda.c | 37 + 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h index 44b58a6..ec1a2a8 100644 --- a/net/irda/irnet/irnet.h +++ b/net/irda/irnet/irnet.h @@ -418,6 +418,7 @@ typedef struct irnet_socket { u32 raccm; /* to please pppd - dummy) */ unsigned int flags; /* PPP flags (compression, ...) */ unsigned int rbits; /* Unused receive flags ??? */ + struct work_struct disconnect_work; /* Process context disconnection */ /* IrTTP part */ /* We create a pseudo socket over the IrDA tranport */ diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c index 843b767..0f462a9 100644 --- a/net/irda/irnet/irnet_irda.c +++ b/net/irda/irnet/irnet_irda.c @@ -10,6 +10,27 @@ #include irnet_irda.h/* Private header */ +/* + * PPP disconnect work: we need to make sure we're in + * process context when calling ppp_unregister_channel(). + */ +static void irnet_ppp_disconnect(struct work_struct *work) +{ + irnet_socket * self = + container_of(work, irnet_socket, disconnect_work); + + if (self == NULL) + return; + /* +* If we were connected, cleanup close the PPP +* channel, which will kill pppd (hangup) and the rest. +*/ + if (self-ppp_open !self-ttp_open !self-ttp_connect) { + ppp_unregister_channel(self-chan); + self-ppp_open = 0; + } +} + /* CONTROL CHANNEL */ /* * When ppp is not active, /dev/irnet act as a control channel. @@ -487,6 +508,8 @@ int irda_irnet_create(irnet_socket * self) #endif /* DISCOVERY_NOMASK */ self-tx_flow = FLOW_START; /* Flow control from IrTTP */ + INIT_WORK(self-disconnect_work, irnet_ppp_disconnect); + DEXIT(IRDA_SOCK_TRACE, \n); return (0); } @@ -1123,18 +1146,8 @@ irnet_disconnect_indication(void *instance, /* Deal with the ppp instance if it's still alive */ if (self-ppp_open) { if (test_open) { -#ifdef MISSING_PPP_API - /* -* ppp_unregister_channel() wants a user context, -* which we are guaranteed to NOT have here. -* What are we supposed to do here ? Jean II */ - /* -* If we were connected, cleanup close the PPP -* channel, which will kill pppd (hangup) and the rest. -*/ - ppp_unregister_channel(self-chan); - self-ppp_open = 0; -#endif + /* ppp_unregister_channel() wants a user context. */ + schedule_work(self-disconnect_work); } else { /* * If we were trying to connect, flush (drain) -- 1.4.4.4 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/6] IrDA: stir4200 useless include
stir4200 doesn't need to include irlap.h Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/stir4200.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index 20d306f..45351f2 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c @@ -52,7 +52,6 @@ #include linux/kthread.h #include linux/freezer.h #include net/irda/irda.h -#include net/irda/irlap.h #include net/irda/irda_device.h #include net/irda/wrapper.h #include net/irda/crc.h -- 1.5.0.2 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] IrDA: Delay needed when uploading firmware chunks
With 42101001.sb firmwares, we need a 10 ms delay between firmware chunks upload. Patch from Nigel Williams [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/irda-usb.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 340ee99..1d510bd 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -1057,6 +1057,8 @@ static int stir421x_fw_upload(struct irda_usb_cb *self, if (ret 0) break; + + mdelay(10); } kfree(patch_block); -- 1.4.4.4 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [irda-users] [PATCH 1/6] IrDA: IrNET code indentation
The IrNET identation patch was too big for netdev limit, so I split it in 2 patches: [PATCH 1a/6] IrDA: IrNET code identation [PATCH 1b/6] IrDA: irnet_irda.c identation My apologies for the mess... Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6 patch] drivers/net/irda/vlsi_ir.{h,c}: remove kernel 2.4 code
On Thu, Jan 18, 2007 at 10:56:13PM +0100, Adrian Bunk wrote: This patch removes kernel 2.4 compatibility code. Looks correct to me, thanks. Signed-off-by: Adrian Bunk [EMAIL PROTECTED] Acked-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/vlsi_ir.c | 16 drivers/net/irda/vlsi_ir.h | 33 - 2 files changed, 8 insertions(+), 41 deletions(-) --- linux-2.6.20-rc4-mm1/drivers/net/irda/vlsi_ir.h.old 2007-01-18 21:50:43.0 +0100 +++ linux-2.6.20-rc4-mm1/drivers/net/irda/vlsi_ir.h 2007-01-18 21:53:54.0 +0100 @@ -41,39 +41,6 @@ #define PCI_CLASS_SUBCLASS_MASK 0x #endif -/* in recent 2.5 interrupt handlers have non-void return value */ -#ifndef IRQ_RETVAL -typedef void irqreturn_t; -#define IRQ_NONE -#define IRQ_HANDLED -#define IRQ_RETVAL(x) -#endif - -/* some stuff need to check kernelversion. Not all 2.5 stuff was present - * in early 2.5.x - the test is merely to separate 2.4 from 2.5 - */ -#include linux/version.h - -#if LINUX_VERSION_CODE KERNEL_VERSION(2,5,0) - -/* PDE() introduced in 2.5.4 */ -#ifdef CONFIG_PROC_FS -#define PDE(inode) ((inode)-i_private) -#endif - -/* irda crc16 calculation exported in 2.5.42 */ -#define irda_calc_crc16(fcs,buf,len) (GOOD_FCS) - -/* we use this for unified pci device name access */ -#define PCIDEV_NAME(pdev)((pdev)-name) - -#else /* 2.5 or later */ - -/* whatever we get from the associated struct device - bus:slot:dev.fn id */ -#define PCIDEV_NAME(pdev)(pci_name(pdev)) - -#endif - /* */ /* non-standard PCI registers */ --- linux-2.6.20-rc4-mm1/drivers/net/irda/vlsi_ir.c.old 2007-01-18 21:53:58.0 +0100 +++ linux-2.6.20-rc4-mm1/drivers/net/irda/vlsi_ir.c 2007-01-18 21:54:56.0 +0100 @@ -166,7 +166,7 @@ unsigned i; seq_printf(seq, \n%s (vid/did: %04x/%04x)\n, -PCIDEV_NAME(pdev), (int)pdev-vendor, (int)pdev-device); +pci_name(pdev), (int)pdev-vendor, (int)pdev-device); seq_printf(seq, pci-power-state: %u\n, (unsigned) pdev-current_state); seq_printf(seq, resources: irq=%u / io=0x%04x / dma_mask=0x%016Lx\n, pdev-irq, (unsigned)pci_resource_start(pdev, 0), (unsigned long long)pdev-dma_mask); @@ -1401,7 +1401,7 @@ if (vlsi_start_hw(idev)) IRDA_ERROR(%s: failed to restart hw - %s(%s) unusable!\n, -__FUNCTION__, PCIDEV_NAME(idev-pdev), ndev-name); +__FUNCTION__, pci_name(idev-pdev), ndev-name); else netif_start_queue(ndev); } @@ -1643,7 +1643,7 @@ pdev-current_state = 0; /* hw must be running now */ IRDA_MESSAGE(%s: IrDA PCI controller %s detected\n, - drivername, PCIDEV_NAME(pdev)); + drivername, pci_name(pdev)); if ( !pci_resource_start(pdev,0) || !(pci_resource_flags(pdev,0) IORESOURCE_IO) ) { @@ -1728,7 +1728,7 @@ pci_set_drvdata(pdev, NULL); - IRDA_MESSAGE(%s: %s removed\n, drivername, PCIDEV_NAME(pdev)); + IRDA_MESSAGE(%s: %s removed\n, drivername, pci_name(pdev)); } #ifdef CONFIG_PM @@ -1748,7 +1748,7 @@ if (!ndev) { IRDA_ERROR(%s - %s: no netdevice \n, -__FUNCTION__, PCIDEV_NAME(pdev)); +__FUNCTION__, pci_name(pdev)); return 0; } idev = ndev-priv; @@ -1759,7 +1759,7 @@ pdev-current_state = state.event; } else - IRDA_ERROR(%s - %s: invalid suspend request %u - %u\n, __FUNCTION__, PCIDEV_NAME(pdev), pdev-current_state, state.event); + IRDA_ERROR(%s - %s: invalid suspend request %u - %u\n, __FUNCTION__, pci_name(pdev), pdev-current_state, state.event); up(idev-sem); return 0; } @@ -1787,7 +1787,7 @@ if (!ndev) { IRDA_ERROR(%s - %s: no netdevice \n, -__FUNCTION__, PCIDEV_NAME(pdev)); +__FUNCTION__, pci_name(pdev)); return 0; } idev = ndev-priv; @@ -1795,7 +1795,7 @@ if (pdev-current_state == 0) { up(idev-sem); IRDA_WARNING(%s - %s: already resumed\n, - __FUNCTION__, PCIDEV_NAME(pdev)); + __FUNCTION__, pci_name(pdev)); return 0; } - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] [IrDA] irda-usb TX path optimization (was Re: IrDA spams logfiles - since 2.6.19)
Hi Dave, Since we stop using dev_alloc_skb on the IrDA TX frame, we constantly run into the case of the skb headroom being 0, and thus we call skb_cow for every IrDA TX frame. This patch uses a local buffer and memcpy the skb to it, saving us a kmalloc for each of those IrDA TX frames. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/irda-usb.c | 43 --- drivers/net/irda/irda-usb.h |1 + 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 3ca1082..8381c04 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -441,25 +441,13 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) goto drop; } - /* Make sure there is room for IrDA-USB header. The actual -* allocation will be done lower in skb_push(). -* Also, we don't use directly skb_cow(), because it require -* headroom = 16, which force unnecessary copies - Jean II */ - if (skb_headroom(skb) self-header_length) { - IRDA_DEBUG(0, %s(), Insuficient skb headroom.\n, __FUNCTION__); - if (skb_cow(skb, self-header_length)) { - IRDA_WARNING(%s(), failed skb_cow() !!!\n, __FUNCTION__); - goto drop; - } - } + memcpy(self-tx_buff + self-header_length, skb-data, skb-len); /* Change setting for next frame */ - if (self-capability IUC_STIR421X) { __u8 turnaround_time; - __u8* frame; + __u8* frame = self-tx_buff; turnaround_time = get_turnaround_time( skb ); - frame= skb_push(skb, self-header_length); irda_usb_build_header(self, frame, 0); frame[2] = turnaround_time; if ((skb-len != 0) @@ -472,17 +460,17 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) frame[1] = 0; } } else { - irda_usb_build_header(self, skb_push(skb, self-header_length), 0); + irda_usb_build_header(self, self-tx_buff, 0); } /* FIXME: Make macro out of this one */ ((struct irda_skb_cb *)skb-cb)-context = self; -usb_fill_bulk_urb(urb, self-usbdev, + usb_fill_bulk_urb(urb, self-usbdev, usb_sndbulkpipe(self-usbdev, self-bulk_out_ep), - skb-data, IRDA_SKB_MAX_MTU, + self-tx_buff, skb-len + self-header_length, write_bulk_callback, skb); - urb-transfer_buffer_length = skb-len; + /* This flag (URB_ZERO_PACKET) indicates that what we send is not * a continuous stream of data but separate packets. * In this case, the USB layer will insert an empty USB frame (TD) @@ -1455,6 +1443,9 @@ static inline void irda_usb_close(struct irda_usb_cb *self) /* Remove the speed buffer */ kfree(self-speed_buff); self-speed_buff = NULL; + + kfree(self-tx_buff); + self-tx_buff = NULL; } /** USB CONFIG SUBROUTINES **/ @@ -1753,9 +1744,14 @@ static int irda_usb_probe(struct usb_interface *intf, memset(self-speed_buff, 0, IRDA_USB_SPEED_MTU); + self-tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self-header_length, + GFP_KERNEL); + if (self-tx_buff == NULL) + goto err_out_4; + ret = irda_usb_open(self); if (ret) - goto err_out_4; + goto err_out_5; IRDA_MESSAGE(IrDA: Registered device %s\n, net-name); usb_set_intfdata(intf, self); @@ -1766,14 +1762,14 @@ static int irda_usb_probe(struct usb_interface *intf, self-needspatch = (ret 0); if (self-needspatch) { IRDA_ERROR(STIR421X: Couldn't upload patch\n); - goto err_out_5; + goto err_out_6; } /* replace IrDA class descriptor with what patched device is now reporting */ irda_desc = irda_usb_find_class_desc (self-usbintf); if (irda_desc == NULL) { ret = -ENODEV; - goto err_out_5; + goto err_out_6; } if (self-irda_desc) kfree (self-irda_desc); @@ -1782,9 +1778,10 @@ static int irda_usb_probe(struct usb_interface *intf, } return 0; - -err_out_5: +err_out_6: unregister_netdev(self-netdev); +err_out_5: + kfree(self-tx_buff); err_out_4: kfree(self-speed_buff); err_out_3: diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h index 6b2271f..e846c38 100644 --- a/drivers/net/irda/irda-usb.h
[PATCH 2/2] [IrDA] Removed incorrect IRDA_ASSERT()
With USB2.0 bulk out MTU can be 512 bytes, so checking it only for 64 bytes is incorrect. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] --- drivers/net/irda/irda-usb.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 8381c04..a66aacf 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -1515,8 +1515,6 @@ static inline int irda_usb_parse_endpoints(struct irda_usb_cb *self, struct usb_ IRDA_DEBUG(0, %s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n, __FUNCTION__, self-bulk_in_ep, self-bulk_out_ep, self-bulk_out_mtu, self-bulk_int_ep); - /* Should be 8, 16, 32 or 64 bytes */ - IRDA_ASSERT(self-bulk_out_mtu == 64, ;); return((self-bulk_in_ep != 0) (self-bulk_out_ep != 0)); } -- 1.4.4.4 - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: IrDA spams logfiles - since 2.6.19
Hi Dave, On Wed, Jan 10, 2007 at 03:26:07PM -0800, David Miller wrote: The warning is a bit extreme because the skb_cow() call does fix things up and makes space available. But it's not the most efficient thing in the world, so it's good that we know about this so we can have a closer work. I want to remove that warning, but first let's figure out what the call chain is that causes skb_headroom() to end up being zero. In Andreas case, the device is probably in discovery mode, sending IrDA discovery frames periodically. For each of them, the path is the following: irlap_slot_timer_expired() irlap_do_event() irlap_state_query() irlap_send_discovery_xid_frame() dev_hard_start_xmit() irda_usb_hard_xmit() irlap_send_discovery_xid_frame() is the one allocating and building the discovery frame. It is an IrLAP frame. As you might remember, this routine used to call dev_alloc_skb() for allocation but now calls alloc_skb(). So, it used to reserve a 16 bytes header, while now it doesn't. The issue here is that the USB-IrDA specification tells us that we have to add a 1 byte header to the IrLAP frame (and this becomes 3 bytes for some devices playing with the spec) before pushing it to the USB bus. So, while the discovery routine returns a correct IrLAP skb, with no headroom, the irda-usb code needs to add a 1 (or 3) bytes header to it. One solution to fix that problem could be to systematically add a header for every allocated IrLAP frame on the IrDA TX path. Since the USB-IrDA spec is defined by the USB-IF, not by the IrDA, I don't really like this solution. It would create code changes all over the IrDA stack only for handling the USB-IrDA case. The second solution would consist of copying the skb-data into some irda-usb.c pre-allocated buffer, instead of always calling skb_cow(). That would save us one kmalloc(). Obviously, there is a performance hit as we're doing one memcpy for each and every packet sent. I think this is a cleaner solution but the performance hit must be taken to account since the IrDA USB dongles are among the most popular IrDA devices. Dave, please let me know what you think about it, and if you agree with my problem description, please let me know which solution you would advice for. The patch for the second solution would look something like that (although I could use some of the skb routines - skb_copy_bits() - to copy the skb data). It's been tested with my USB stir4220 based IrDA dongle: diff --git a/drivers/net/irda/irda-usb.h b/drivers/net/irda/irda-usb.h index 6b2271f..e846c38 100644 --- a/drivers/net/irda/irda-usb.h +++ b/drivers/net/irda/irda-usb.h @@ -156,6 +156,7 @@ struct irda_usb_cb { struct irlap_cb *irlap; /* The link layer we are binded to */ struct qos_info qos; char *speed_buff; /* Buffer for speed changes */ + char *tx_buff; struct timeval stamp; struct timeval now; diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 3ca1082..5f22a8e 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c @@ -441,25 +441,14 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) goto drop; } - /* Make sure there is room for IrDA-USB header. The actual -* allocation will be done lower in skb_push(). -* Also, we don't use directly skb_cow(), because it require -* headroom = 16, which force unnecessary copies - Jean II */ - if (skb_headroom(skb) self-header_length) { - IRDA_DEBUG(0, %s(), Insuficient skb headroom.\n, __FUNCTION__); - if (skb_cow(skb, self-header_length)) { - IRDA_WARNING(%s(), failed skb_cow() !!!\n, __FUNCTION__); - goto drop; - } - } + memset(self-tx_buff, 0, IRDA_SKB_MAX_MTU + self-header_length); + memcpy(self-tx_buff + self-header_length, skb-data, skb-len); /* Change setting for next frame */ - if (self-capability IUC_STIR421X) { __u8 turnaround_time; - __u8* frame; + __u8* frame = self-tx_buff; turnaround_time = get_turnaround_time( skb ); - frame= skb_push(skb, self-header_length); irda_usb_build_header(self, frame, 0); frame[2] = turnaround_time; if ((skb-len != 0) @@ -472,17 +461,18 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev) frame[1] = 0; } } else { - irda_usb_build_header(self, skb_push(skb, self-header_length), 0); + irda_usb_build_header(self, self-tx_buff, 0); } /* FIXME: Make macro out of this one */ ((struct irda_skb_cb *)skb-cb)-context = self; -usb_fill_bulk_urb(urb, self-usbdev, + usb_fill_bulk_urb(urb,
Re: [PATCH] irda: handle out of memory errors
On Tue, Dec 19, 2006 at 05:55:09PM +0900, Akinobu Mita wrote: This patch checks return value of memory allocation functions for irda subsystem and fixes memory leaks in error cases. Cc: Samuel Ortiz [EMAIL PROTECTED] Signed-off-by: Akinobu Mita [EMAIL PROTECTED] That looks correct, thanks for the patch. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] Cheers, Samuel. --- net/irda/irias_object.c | 40 1 file changed, 40 insertions(+) Index: 2.6-mm/net/irda/irias_object.c === --- 2.6-mm.orig/net/irda/irias_object.c +++ 2.6-mm/net/irda/irias_object.c @@ -91,6 +91,12 @@ struct ias_object *irias_new_object( cha obj-magic = IAS_OBJECT_MAGIC; obj-name = strndup(name, IAS_MAX_CLASSNAME); + if (!obj-name) { + IRDA_WARNING(%s(), Unable to allocate name!\n, + __FUNCTION__); + kfree(obj); + return NULL; + } obj-id = id; /* Locking notes : the attrib spinlock has lower precendence @@ -101,6 +107,7 @@ struct ias_object *irias_new_object( cha if (obj-attribs == NULL) { IRDA_WARNING(%s(), Unable to allocate attribs!\n, __FUNCTION__); + kfree(obj-name); kfree(obj); return NULL; } @@ -357,6 +364,15 @@ void irias_add_integer_attrib(struct ias /* Insert value */ attrib-value = irias_new_integer_value(value); + if (!attrib-name || !attrib-value) { + IRDA_WARNING(%s: Unable to allocate attribute!\n, + __FUNCTION__); + if (attrib-value) + irias_delete_value(attrib-value); + kfree(attrib-name); + kfree(attrib); + return; + } irias_add_attrib(obj, attrib, owner); } @@ -391,6 +407,15 @@ void irias_add_octseq_attrib(struct ias_ attrib-name = strndup(name, IAS_MAX_ATTRIBNAME); attrib-value = irias_new_octseq_value( octets, len); + if (!attrib-name || !attrib-value) { + IRDA_WARNING(%s: Unable to allocate attribute!\n, + __FUNCTION__); + if (attrib-value) + irias_delete_value(attrib-value); + kfree(attrib-name); + kfree(attrib); + return; + } irias_add_attrib(obj, attrib, owner); } @@ -424,6 +449,15 @@ void irias_add_string_attrib(struct ias_ attrib-name = strndup(name, IAS_MAX_ATTRIBNAME); attrib-value = irias_new_string_value(value); + if (!attrib-name || !attrib-value) { + IRDA_WARNING(%s: Unable to allocate attribute!\n, + __FUNCTION__); + if (attrib-value) + irias_delete_value(attrib-value); + kfree(attrib-name); + kfree(attrib); + return; + } irias_add_attrib(obj, attrib, owner); } @@ -473,6 +507,12 @@ struct ias_value *irias_new_string_value value-type = IAS_STRING; value-charset = CS_ASCII; value-t.string = strndup(string, IAS_MAX_STRING); + if (!value-t.string) { + IRDA_WARNING(%s: Unable to kmalloc!\n, __FUNCTION__); + kfree(value); + return NULL; + } + value-len = strlen(value-t.string); return value; - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] irlan: handle out of memory errors
On Tue, Dec 19, 2006 at 05:56:01PM +0900, Akinobu Mita wrote: This patch checks return values: - irlmp_register_client() - irlmp_register_service() - irlan_open() Cc: Samuel Ortiz [EMAIL PROTECTED] Signed-off-by: Akinobu Mita [EMAIL PROTECTED] This one seems correct as well, thanks again. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] Cheers, Samuel. --- net/irda/irlan/irlan_common.c | 23 --- 1 file changed, 20 insertions(+), 3 deletions(-) Index: 2.6-mm/net/irda/irlan/irlan_common.c === --- 2.6-mm.orig/net/irda/irlan/irlan_common.c +++ 2.6-mm/net/irda/irlan/irlan_common.c @@ -144,12 +144,18 @@ static int __init irlan_init(void) /* Register with IrLMP as a client */ ckey = irlmp_register_client(hints, irlan_client_discovery_indication, NULL, NULL); - + if (!ckey) + goto err_ckey; + /* Register with IrLMP as a service */ - skey = irlmp_register_service(hints); + skey = irlmp_register_service(hints); + if (!skey) + goto err_skey; /* Start the master IrLAN instance (the only one for now) */ - new = irlan_open(DEV_ADDR_ANY, DEV_ADDR_ANY); + new = irlan_open(DEV_ADDR_ANY, DEV_ADDR_ANY); + if (!new) + goto err_open; /* The master will only open its (listen) control TSAP */ irlan_provider_open_ctrl_tsap(new); @@ -158,6 +164,17 @@ static int __init irlan_init(void) irlmp_discovery_request(DISCOVERY_DEFAULT_SLOTS); return 0; + +err_open: + irlmp_unregister_service(skey); +err_skey: + irlmp_unregister_client(ckey); +err_ckey: +#ifdef CONFIG_PROC_FS + remove_proc_entry(irlan, proc_irda); +#endif /* CONFIG_PROC_FS */ + + return -ENOMEM; } static void __exit irlan_cleanup(void) - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2.6 patch] net/irda/: proper prototypes
Hi Adrian, On Mon, Dec 18, 2006 at 04:46:26AM +0100, Adrian Bunk wrote: This patch adds proper prototypes for some functions in include/net/irda/irda.h Signed-off-by: Adrian Bunk [EMAIL PROTECTED] looks good to me, thanks. Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] Cheers, Samuel. --- include/net/irda/irda.h | 15 +++ net/irda/irmod.c| 13 - 2 files changed, 15 insertions(+), 13 deletions(-) --- linux-2.6.20-rc1-mm1/include/net/irda/irda.h.old 2006-12-18 02:49:02.0 +0100 +++ linux-2.6.20-rc1-mm1/include/net/irda/irda.h 2006-12-18 02:58:02.0 +0100 @@ -113,4 +113,19 @@ #define IAS_IRCOMM_ID 0x2343 #define IAS_IRLPT_ID 0x9876 +struct net_device; +struct packet_type; + +void irda_proc_register(void); +void irda_proc_unregister(void); + +int irda_sysctl_register(void); +void irda_sysctl_unregister(void); + +int irsock_init(void); +void irsock_cleanup(void); + +int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, + struct packet_type *ptype, struct net_device *orig_dev); + #endif /* NET_IRDA_H */ --- linux-2.6.20-rc1-mm1/net/irda/irmod.c.old 2006-12-18 02:52:18.0 +0100 +++ linux-2.6.20-rc1-mm1/net/irda/irmod.c 2006-12-18 02:53:59.0 +0100 @@ -42,19 +42,6 @@ #include net/irda/irttp.h /* irttp_init */ #include net/irda/irda_device.h/* irda_device_init */ -/* irproc.c */ -extern void irda_proc_register(void); -extern void irda_proc_unregister(void); -/* irsysctl.c */ -extern int irda_sysctl_register(void); -extern void irda_sysctl_unregister(void); -/* af_irda.c */ -extern int irsock_init(void); -extern void irsock_cleanup(void); -/* irlap_frame.c */ -extern int irlap_driver_rcv(struct sk_buff *, struct net_device *, - struct packet_type *, struct net_device *); - /* * Module parameters */ - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] irlan: fix header build warning
Hi Randy, Thanks for the patch. Looks fine to me. On Wed, Dec 06, 2006 at 11:44:07AM -0800, Randy Dunlap wrote: From: Randy Dunlap [EMAIL PROTECTED] Fix compile warning when CONFIG_PROC_FS=n: include/net/irda/irlan_filter.h:31: warning: 'struct seq_file' declared inside parameter list include/net/irda/irlan_filter.h:31: warning: its scope is only this definition or declaration, which is probably not what you want Signed-off-by: Randy Dunlap [EMAIL PROTECTED] Signed-off-by: Samuel Ortiz [EMAIL PROTECTED] Cheers, Samuel. - To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html