Re: how can I find where is the macro or function deifined

2015-07-28 Thread Gnoleba GNOGBO
Can you give a procedure step by step  please to answer please ?
B. Regards

Gnogbo
 Le 28 juil. 2015 17:41, Navy Cheng nav...@126.com a écrit :

 On Tue, Jul 28, 2015 at 06:03:16PM +0200, Ahmed Soliman wrote:
  Hi;
  when I used libc I never memorized where each function is located
  beyond the basics (for example I never knew if strlen is in string.h
  or ctype.h or strlib.h )
  I just check out the functions man pages by man strlen
  is their such functionality for the kernel where I dont need to
  memorize the dependencies for example if MODULE_LICENSE is in kernel.h
  or module.h with out using the internel to google them .
 
 *make tags* in the root directory of the kernel tree. Then a file named
 TAGS
 is created. TAGS is treated as one part of the tree when *git status*. You
 can load it with Vim or emacs. Google it for details.


 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: how can I find where is the macro or function deifined

2015-07-28 Thread Iuro Nascimento
Hi,

git grep is very usefull to find stuff in the kernel tree. You can find macros 
using:

git grep -n '#define list_entry('

to find file and line number of the macro list_entry.

Regards,

Iuro Nascimento

On Tue, Jul 28, 2015 at 06:03:16PM +0200, Ahmed Soliman wrote:
 Hi;
 when I used libc I never memorized where each function is located
 beyond the basics (for example I never knew if strlen is in string.h
 or ctype.h or strlib.h )
 I just check out the functions man pages by man strlen
 is their such functionality for the kernel where I dont need to
 memorize the dependencies for example if MODULE_LICENSE is in kernel.h
 or module.h with out using the internel to google them .
 
 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: how can I find where is the macro or function deifined

2015-07-28 Thread Valdis . Kletnieks
On Tue, 28 Jul 2015 23:54:36 -, Gnoleba GNOGBO said:
 Can you give a procedure step by step  please to answer please ?

http://www.lmgtfy.com/?q=ctags+vim+tutorial
http://www.lmgtfy.com/?q=ctags+emacs+tutorial


pgpdWdmIZQnYO.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


bitops for handling 32 bits

2015-07-28 Thread Kevin Wilson
Hi all,
Is there a kernel API for handling 32 bits ?
I see a macro like BIT(nr)
http://lxr.free-electrons.com/source/include/linux/bitops.h#L6

#define BIT(nr) (1UL  (nr))

and also
#define BIT_ULL(nr) (1ULL  (nr))

However, these macros are using 64 bit semantics, so if I will use
them with 32 bits values
the results will  be wrong.

Any ideas ?

Regards,
Kevin

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: bitops for handling 32 bits

2015-07-28 Thread Manavendra Nath Manav
On Tue 28 Jul, 2015 20:24 Kevin Wilson wkev...@gmail.com wrote:

 Hi all,
 Is there a kernel API for handling 32 bits ?
 I see a macro like BIT(nr)
 http://lxr.free-electrons.com/source/include/linux/bitops.h#L6

 #define BIT(nr) (1UL  (nr))

 and also
 #define BIT_ULL(nr) (1ULL  (nr))

 However, these macros are using 64 bit semantics, so if I will use
 them with 32 bits values
 the results will  be wrong.

 Any ideas ?

 Regards,
 Kevin

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

The macros don't do type checking so it will work for both 32-bit and
64-bit.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


how can I find where is the macro or function deifined

2015-07-28 Thread Ahmed Soliman
Hi;
when I used libc I never memorized where each function is located
beyond the basics (for example I never knew if strlen is in string.h
or ctype.h or strlib.h )
I just check out the functions man pages by man strlen
is their such functionality for the kernel where I dont need to
memorize the dependencies for example if MODULE_LICENSE is in kernel.h
or module.h with out using the internel to google them .

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: how can I find where is the macro or function deifined

2015-07-28 Thread Navy Cheng
On Tue, Jul 28, 2015 at 08:25:04PM -0400, valdis.kletni...@vt.edu wrote:
 On Tue, 28 Jul 2015 23:54:36 -, Gnoleba GNOGBO said:
  Can you give a procedure step by step  please to answer please ?
 
 http://www.lmgtfy.com/?q=ctags+vim+tutorial
 http://www.lmgtfy.com/?q=ctags+emacs+tutorial

Hi, Valdis
Thanks for your answer but I can't  open these links. 


For example, you have a kernel tree, ~/linux-4.1, in your pc. 

steps:

+ cd ~/linux-4.1
+ make tags  = Now,TAGS is created
+ Both emacs and vim can use TAGS. I don't konw if other editers can do such
  things
  + for emacs: 
+ *M-x visit-tags-table* and load TAGS
+ M-. =find tag
+ C-u M-. =go to the next matched tag
+ M-*  = return to last tag
  + for vim:
+ Just open vim in ~/linux-4.1
+ open the source files and put the cursor on the tags you are interested
+ ctrl + ] = goto the tag
+ ctrl + t = return to your last tag

tips:

Hi,gnognoleba
I think these answers is easy to find on the internet, and learning from the
internet is a important skill. Finding on net is faster for you. It's better to
google it first. If there is not answers you want, come to here and every one 
is pleasure to help you.
Hi 


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: how can I find where is the macro or function deifined

2015-07-28 Thread Manavendra Nath Manav
On Tue 28 Jul, 2015 21:41 Ahmed Soliman ahmedsoliman0x...@gmail.com wrote:

Hi;
when I used libc I never memorized where each function is located
beyond the basics (for example I never knew if strlen is in string.h
or ctype.h or strlib.h )
I just check out the functions man pages by man strlen
is their such functionality for the kernel where I dont need to
memorize the dependencies for example if MODULE_LICENSE is in kernel.h
or module.h with out using the internel to google them .

__



You can use cscope and/or ctags to jump directly to the symbol definition.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: bitops for handling 32 bits

2015-07-28 Thread Anish Kumar




 On Jul 28, 2015, at 10:46 PM, Kevin Wilson wkev...@gmail.com wrote:
 
 Hi all,
 Is there a kernel API for handling 32 bits ?
 I see a macro like BIT(nr)
 http://lxr.free-electrons.com/source/include/linux/bitops.h#L6
 
 #define BIT(nr) (1UL  (nr))
 
 and also
 #define BIT_ULL(nr) (1ULL  (nr))
 
 However, these macros are using 64 bit semantics, so if I will use
 them with 32 bits values
 the results will  be wrong.

Did you try using it? The code is generic.
 
 Any ideas ?
 
 Regards,
 Kevin
 
 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: HOSTAPD Error log

2015-07-28 Thread Amit Gupta
Hi All,
Thanks for your quick response.

Valdis,
I tried with strace stuff, but I faced CPU halt issue. Actually along with
those error logs..sometime I m facing CPU HALT issue after executing
#hostapd -B /etc/hostapd.conf.



Pranay,
I tried your way to debug kernel for finding the root cause of error
log 'Failed
to update rate sets in kernel module'.
But prior to that I started to debugging for

IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

those two logs.

Till now I found that before execution of __dev_open(net/core/dev,c) function
for 'wlan0' network interface, 'netif_carrier_off'(net/sched/sch_generic.c)
function get called for 'wlan0',

void netif_carrier_off
http://lxr.free-electrons.com/ident?v=4.0;i=netif_carrier_off(struct
net_device http://lxr.free-electrons.com/ident?v=4.0;i=net_device
*dev http://lxr.free-electrons.com/ident?v=4.0;i=dev)
 {
 if (!test_and_set_bit
http://lxr.free-electrons.com/ident?v=4.0;i=test_and_set_bit(__LINK_STATE_NOCARRIER,
dev http://lxr.free-electrons.com/ident?v=4.0;i=dev-state
http://lxr.free-electrons.com/ident?v=4.0;i=state)) {
 if (dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev-reg_state
http://lxr.free-electrons.com/ident?v=4.0;i=reg_state ==
NETREG_UNINITIALIZED)
 return;
 atomic_inc
http://lxr.free-electrons.com/ident?v=4.0;i=atomic_inc(dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev-carrier_changes);
 linkwatch_fire_event
http://lxr.free-electrons.com/ident?v=4.0;i=linkwatch_fire_event(dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev);
 }
}

 which result into condition checking passed in 'addrconf_qdisc_ok
http://lxr.free-electrons.com/ident?v=4.0;i=addrconf_qdisc_ok'*
function.*

In 'net/ipv6/addrconf.c' file

if (event http://lxr.free-electrons.com/ident?v=4.0;i=event ==
NETDEV_UP http://lxr.free-electrons.com/ident?v=4.0;i=NETDEV_UP) {
 if (!addrconf_qdisc_ok
http://lxr.free-electrons.com/ident?v=4.0;i=addrconf_qdisc_ok(dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev)) {
 */* device is not ready yet. */*
 pr_info
http://lxr.free-electrons.com/ident?v=4.0;i=pr_info(*ADDRCONF(NETDEV_UP):
%s: link is not ready\n*,
dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev-name
http://lxr.free-electrons.com/ident?v=4.0;i=name);
 break;
 }

in same file:

static inline bool http://lxr.free-electrons.com/ident?v=4.0;i=bool
addrconf_qdisc_ok
http://lxr.free-electrons.com/ident?v=4.0;i=addrconf_qdisc_ok(const
struct net_device
http://lxr.free-electrons.com/ident?v=4.0;i=net_device *dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev) {

return !qdisc_tx_is_noop
http://lxr.free-electrons.com/ident?v=4.0;i=qdisc_tx_is_noop(dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev);

}

In include/net/sch_generic.h file

 static inline bool http://lxr.free-electrons.com/ident?v=4.0;i=bool
qdisc_tx_is_noop
http://lxr.free-electrons.com/ident?v=4.0;i=qdisc_tx_is_noop(const
struct net_device
http://lxr.free-electrons.com/ident?v=4.0;i=net_device *dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev)

 {

 unsigned int i http://lxr.free-electrons.com/ident?v=4.0;i=i;


 for (i http://lxr.free-electrons.com/ident?v=4.0;i=i = 0; i
http://lxr.free-electrons.com/ident?v=4.0;i=i  dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev-num_tx_queues; i
http://lxr.free-electrons.com/ident?v=4.0;i=i++) {
 struct netdev_queue
http://lxr.free-electrons.com/ident?v=4.0;i=netdev_queue *txq =
netdev_get_tx_queue
http://lxr.free-electrons.com/ident?v=4.0;i=netdev_get_tx_queue(dev
http://lxr.free-electrons.com/ident?v=4.0;i=dev, i
http://lxr.free-electrons.com/ident?v=4.0;i=i);
 if (rcu_access_pointer
http://lxr.free-electrons.com/ident?v=4.0;i=rcu_access_pointer(txq-qdisc)
!= noop_qdisc http://lxr.free-electrons.com/ident?v=4.0;i=noop_qdisc)
 return false
http://lxr.free-electrons.com/ident?v=4.0;i=false;
 }
 return true http://lxr.free-electrons.com/ident?v=4.0;i=true;
 }


I am still looking to find the cause execution of net_carrier_off function
before execution of __dev_open function for 'wlan0' network interface. This
behavior I am not observing with my other wired and pseudo network
interfaces.

'Failed to update rate sets in kernel module'
This error log may come because of previous issue as wlan0 device is not
active till this point.


One more thing  I tried, I cross compiled 'hostapd' version 2.4 for my
target board and executed that on target board.I did not get above
mentioned error log and till now no CPU halt issue.

Previously i was working with hostapd 0.7.3.


So is it like, hostapd old version is not compatible with new linux kernel

Re: how can I find where is the macro or function deifined

2015-07-28 Thread Navy Cheng
On Tue, Jul 28, 2015 at 06:03:16PM +0200, Ahmed Soliman wrote:
 Hi;
 when I used libc I never memorized where each function is located
 beyond the basics (for example I never knew if strlen is in string.h
 or ctype.h or strlib.h )
 I just check out the functions man pages by man strlen
 is their such functionality for the kernel where I dont need to
 memorize the dependencies for example if MODULE_LICENSE is in kernel.h
 or module.h with out using the internel to google them .
 
*make tags* in the root directory of the kernel tree. Then a file named TAGS
is created. TAGS is treated as one part of the tree when *git status*. You
can load it with Vim or emacs. Google it for details. 


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies