Re: Generic netlink interface help
On Sun, May 27, 2007 at 03:24:56PM +0200, Johannes Berg wrote: My current userland tool just send a message and expects back a response. Obviously that's broken once we have events too, is that when Is that written by using the libnl or not? Can you please send to me it, or just a portion of it, in order to better understand how I can send messages to the kernel? Thanks, 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
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? Thanks, 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
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? 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
Generic netlink interface help
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? 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? Thanks, 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
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 Thanks, I'll take a look to it! 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? Thanks, 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
On Thu, May 24, 2007 at 10:04:08AM -, Samuel Ortiz wrote: Yes it's possible, even though it could be more tedious and painful. I know that. Have you some links to suggest to me in order to have some programming examples? Thanks, 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
[PATCH] au1000_eth.c power management and driver registration support
Hello, Attached you can find my patch to add power managament and driver registration to the new version of file drivers/net/au1000_eth.c that implements the PHY-layer support. Ciao, Rodolfo Giometti Signed-off-by: Rodolfo Giometti [EMAIL PROTECTED] -- GNU/Linux Solutions e-mail:[EMAIL PROTECTED] Linux Device Driver [EMAIL PROTECTED] Embedded Systems[EMAIL PROTECTED] UNIX programming phone: +39 349 2432127 diff --git a/arch/mips/au1000/common/au1xxx_irqmap.c b/arch/mips/au1000/common/au1xxx_irqmap.c index 7acfe9b..d94bde1 100644 --- a/arch/mips/au1000/common/au1xxx_irqmap.c +++ b/arch/mips/au1000/common/au1xxx_irqmap.c @@ -117,7 +117,7 @@ #elif defined(CONFIG_SOC_AU1500) { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, - { AU1500_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, + { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, { AU1500_MAC1_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, @@ -151,7 +151,7 @@ #elif defined(CONFIG_SOC_AU1100) { AU1000_USB_DEV_SUS_INT, INTC_INT_RISE_EDGE, 0 }, { AU1000_USB_HOST_INT, INTC_INT_LOW_LEVEL, 0 }, { AU1000_ACSYNC_INT, INTC_INT_RISE_EDGE, 0 }, - { AU1100_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, + { AU1000_MAC0_DMA_INT, INTC_INT_HIGH_LEVEL, 0}, /*{ AU1000_GPIO215_208_INT, INTC_INT_HIGH_LEVEL, 0},*/ { AU1100_LCD_INT, INTC_INT_HIGH_LEVEL, 0}, { AU1000_AC97C_INT, INTC_INT_RISE_EDGE, 0 }, diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c index 8fd203d..ec81d4b 100644 --- a/arch/mips/au1000/common/platform.c +++ b/arch/mips/au1000/common/platform.c @@ -15,6 +15,78 @@ #include linux/resource.h #include asm/mach-au1x00/au1xxx.h +#if defined(CONFIG_MIPS_AU1X00_ENET) || defined(CONFIG_MIPS_AU1X00_ENET_MODULE) +/* Ethernet controllers */ +static struct resource au1xxx_eth0_resources[] = { + [0] = { + .name = eth-base, + .start = ETH0_BASE, + .end= ETH0_BASE + MAC_IOSIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .name = eth-mac, + .start = MAC0_ENABLE, + .end= MAC0_ENABLE + 4 - 1, + .flags = IORESOURCE_MEM, + }, + [2] = { + .name = eth-irq, +#if defined(CONFIG_SOC_AU1550) + .start = AU1550_MAC0_DMA_INT, + .end= AU1550_MAC0_DMA_INT, +#else + .start = AU1000_MAC0_DMA_INT, + .end= AU1000_MAC0_DMA_INT, +#endif + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device au1xxx_eth0_device = { + .name = au1000_eth, + .id = 0, + .num_resources = ARRAY_SIZE(au1xxx_eth0_resources), + .resource = au1xxx_eth0_resources, +}; + +#if defined(CONFIG_SOC_AU1000) || \ +defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550) +static struct resource au1xxx_eth1_resources[] = { + [0] = { + .name = eth-base, + .start = ETH1_BASE, + .end= ETH1_BASE + MAC_IOSIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .name = eth-mac, + .start = MAC1_ENABLE, + .end= MAC1_ENABLE + 4 - 1, + .flags = IORESOURCE_MEM, + }, + [2] = { + .name = eth-irq, +#if defined(CONFIG_SOC_AU1550) + .start = AU1550_MAC1_DMA_INT, + .end= AU1550_MAC1_DMA_INT, +#else + .start = AU1000_MAC1_DMA_INT, + .end= AU1000_MAC1_DMA_INT, +#endif + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device au1xxx_eth1_device = { + .name = au1000_eth, + .id = 1, + .num_resources = ARRAY_SIZE(au1xxx_eth1_resources), + .resource = au1xxx_eth1_resources, +}; +#endif +#endif + /* OHCI (USB full speed host controller) */ static struct resource au1xxx_usb_ohci_resources[] = { [0] = { @@ -270,7 +367,14 @@ static struct platform_device smc91x_dev #endif static struct platform_device *au1xxx_platform_devices[] __initdata = { +#if defined(CONFIG_MIPS_AU1X00_ENET) || defined(CONFIG_MIPS_AU1X00_ENET_MODULE) + au1xxx_eth0_device, +#if defined(CONFIG_SOC_AU1000) || \ +defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550) + au1xxx_eth1_device, +#endif +#endif au1xxx_usb_ohci_device, au1x00_pcmcia_device, #ifdef CONFIG_FB_AU1100 diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 27d465f..47c624b 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -453,13 +453,13
Re: [PATCH] au1000_eth.c Power Management, driver registration and module support
Hello, yesterday I did a little mess with GIT... now the patch is complete. Sorry. :) I forgot also to say that it has been done against «linux-2.6.16-stable» branch. Ciao, Rodolfo -- GNU/Linux Solutions e-mail:[EMAIL PROTECTED] Linux Device Driver [EMAIL PROTECTED] Embedded Systems[EMAIL PROTECTED] UNIX programming phone: +39 349 2432127 signature.asc Description: Digital signature