Re: sock_create vs socket_create_kern

2009-03-02 Thread Alan Menegotto

Daniel Baluta escreveu:

Hello ,

What is the difference between those two functions?

I've looked through the source code and i found this:


 int sock_create(int family, int type, int protocol, struct socket **res)
{
 return __sock_create(current-nsproxy-net_ns, family, type,
protocol, res, 0);
}

int sock_create_kern(int family, int type, int protocol, struct socket **res)
{
 return __sock_create(init_net, family, type, protocol, res, 1);
}

Any ideas?

thanks,
Daniel.

--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ


  
It seems that sock_create is used on the socket implementation itself. 
sock_create_kern is used in socket family implementations (like inet 
socket for instance - see net/ipv4/af_inet.c, function inet_ct_sock_create).



Best Regards

Alan Menegotto


--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: how to

2008-12-16 Thread Alan Menegotto

Li, Chanjuan escreveu:

在 2008-12-16二的 07:57 -0200,Alan Menegotto写道:
  

Li, Chanjuan escreveu:


hi,all:
 I am a newbie on linux kernel. now I encountered a problem on 
socket in kernel space.I create a SOCK_DGRAM socket in kernel space . 
What I want to do can

be described as follows:
  while(1){
if( packet received)
   call packet handler
}

my problem is how to know packet received at kernel space. In user 
space there is select() to use, but in kernel space, there is no such 
function.
I have read sk_buff  and struct sock definition to find some hint, but 
still have no idea. I think it is a good place to ask for help. thanks 
in advance.



lily 
   
  

Are you writing a protocol or sending/receiving datagrams on kernel space?


I am writing a protocol. but because I am newbie on linux kernel,so I do a 
simple exercise first.

lily
  

Best Regards

Alan Menegotto




  
So you must create a struct proto (see an example on 
net/ipv4/tcp_ipv4.c) where you'll register a handler for every protocol 
operation (connect, sendmsg, recvmsg, etc...). Then you'll use the 
created struct on net/ipv4/af_inet.c. There are some constants to define 
too.


Look the source code of another protocol (like tcp, udp or dccp) to 
guide you thru' the structs creation and protocol initialization. It's 
kinda like a cook recipe.


When the structs are created and the protocol inserted on the kernel, 
just write the action handlers defined on your structures.



Best Regards

Alan Menegotto



--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: how to

2008-12-16 Thread Alan Menegotto

Li, Chanjuan escreveu:

hi,all:
 I am a newbie on linux kernel. now I encountered a problem on 
socket in kernel space.I create a SOCK_DGRAM socket in kernel space . 
What I want to do can

be described as follows:
  while(1){
if( packet received)
   call packet handler
}

my problem is how to know packet received at kernel space. In user 
space there is select() to use, but in kernel space, there is no such 
function.
I have read sk_buff  and struct sock definition to find some hint, but 
still have no idea. I think it is a good place to ask for help. thanks 
in advance.



lily 
   

Are you writing a protocol or sending/receiving datagrams on kernel space?



Best Regards

Alan Menegotto

--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: network delay simulation

2008-09-29 Thread Alan Menegotto




Bizhan Gholikhamseh (bgholikh) escreveu:

  
  
  Hi
all,
  Is
there a mechanism to simulate random network latencies within kernel?
for example do a net/scheduleror just FIFO delay within network driver?
  
  Regards,
  Bizhan

pktgen can help you.

http://www.mjmwired.net/kernel/Documentation/networking/pktgen.txt



Best regards

Alan Menegotto



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Machine hang - how to know what happens?

2008-06-09 Thread Alan Menegotto

Shreyansh Jain escreveu:

Dear All,

I have a Intel desktop machine having P4 processor and 512MB RAM. It
has a custom 2.6.25 (custom because config has been changed to
de-select/select unnecessary/required things before compilation)
running over SLES10 distro.

I have noticed that this machine tends to hang after running
un-interrupted for a certain number of days. There is no fixed pattern
that happens (no fixed number of days), and hangs might occur as
frequent as 2-3 days and as delayed as 7 days.

I have noticed this happening for no apparent reason. This machine is
being used as a ssh box containing a repository of kernel sources -
thats it. There is no configured web-server or background application
running on this.

Problem:
1. The hangs is such that there is nothing on the display and hence I
cannot see what state the machine is (not that I am expecting that
would help in such case).
2. There is nothing unsual in /var/log/messages, /var/log/warn,
/var/log/mcelog ... and many other log files.
3. There is no crash dump either, even when I have configured
kexec/kdump on this. It work, becuase I tested it by triggering using
sysrq.
4. There are no kernel messages about any failed device or similar
things in past logs (once I have rebooted).

Output of /var/log/messages from one of the most recent stall is:

---8
Jun  9 04:25:35 DogMatix syslog-ng[3516]: STATS: dropped 0
Jun  9 05:25:36 DogMatix syslog-ng[3516]: STATS: dropped 0
Jun  9 06:25:36 DogMatix syslog-ng[3516]: STATS: dropped 0
Jun  9 07:25:36 DogMatix syslog-ng[3516]: STATS: dropped 0
Jun  9 08:25:36 DogMatix syslog-ng[3516]: STATS: dropped 0
Jun  9 09:25:36 DogMatix syslog-ng[3516]: STATS: dropped 0
Jun  9 12:44:12 DogMatix syslog-ng[2732]: syslog-ng version 1.6.8 starting
8

Notice that syslog is printing something each hour, and then there is
stall after 09:25. Last line is bootup message after hard-booting the
machine.
Dogmatix is the name of the machine.

Question:
What should be done in such situations? What can be a reliable method
to know the real reason behing such stalls?
Any ideas/hints/suggestions are most welcome. I would like to solve
this mystery rather than live with it.

--
Shreyansh

--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ


  

You must check the main reasons for this:

a) run memtest;
b) check the processor, disks and any other temperature available;
c) check for bad pci devices like network cards. This is the hard part 
IMO because there's no log.


In a nutshell, you must eliminate every hardware piece, one by one. 
Then, you'll find the culprit.


--


--
Best Regards

Alan Menegotto


--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Improving ide latency and file system performance

2008-05-06 Thread Alan Menegotto




Scott Lovenberg escreveu:

  
  
Bizhan Gholikhamseh (bgholikh) wrote:
  


Hi
All,
Are
there any kernel parameterscouldimprove system performance in area of
IDE access and file system?

In
our embedded system, We have disabled the read ahead for ide device
(Compact Flash), mounted the CF device with "noatime, sync" option. At
least disabling the read ahead has improved the RT tasks not to miss
their scheduled slot (10 msec).
We
have created ext3 file system on CF, are there any kernel parameters
that improve the file system performance, I/O scheduler, etc...?
We
do not care if thedata rateis slower for CF, just better performance.

Our
Linux version is 2.6.11.

Many
thanks in advance,
Bizhan
  
You'll want to use the "No-op" scheduler. Also, you can add
"nodiratime" to your mounting options.

Also your kernel is too old. I don't know if you can update it (because
of the RT stuff). There are a lot of improvement in the IO-Scheduler
area.

-- 


--
Best Regards

Alan Menegotto



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: listen backlog increase

2008-01-10 Thread Alan Menegotto




jasjit singh escreveu:

  
  Hi
  
I have been facing problems regarding listen call of TCP/ IP. There is
a hard limit imposed by the system on the value of backlog. So server
is not able to handle more than 256 requests at a time. Additional
requests are dropped, i think. Is there any way out to change this
limit in some system file?
   
  Regards n Thanks,
Jasjit Singh
  
  
  
  
   Sent from Yahoo!
- a smarter inbox.
Look at 'man tcp', parameter tcp_max_syn_backlog. You can increase it
by hand or add more RAM to the machine.

--
Best Regards

Alan Menegotto



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: about virtual

2007-10-30 Thread Alan Menegotto

amol verule escreveu:

hi to all,
 i am using vmware when i run command #uname -r  in 
guest OS then it is showing guest OS kernel version.

means two kernel are running.how it is possible?
regards
amol

http://en.wikipedia.org/wiki/Virtualization

--


--
Best Regards

Alan Menegotto


--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: IPX performance

2007-10-24 Thread Alan Menegotto

Rafal Cygnarowski escreveu:

Hi!

I use old mars_nwe but have problems with its performance. It works really
poor. I would like to check if it's just IPX subsystem problem (== kernel
problem?) or just poor mars_nwe code. Unfortunately I can't find any IPX
benchmarks and I have no real Netware servers to compare. What can I do in
such case? How can I measure IPX performance in linux kernel?

Best regards,
  

Hi.

I work with a couple of netware servers mounted on a linux backup server 
(thru' ncpmount) and it works with the same performance as a windows 
client. So I would not blame the IPX layer.


I tested mars_nwe 6 years ago and the performance isn't good enough to 
replace my netware servers. I though it could be improved as time goes 
by, but it seems that it hasn't changed so much at all.



--


--
Best Regards

Alan Menegotto


--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Need help in figuring out how the IP stack is implemented in the kernel.

2007-10-09 Thread Alan Menegotto




Thippeswamy, Aravind escreveu:

  
  
  
  
  Hi,
   I am a
typical newbie trying to get my bearings
right in the kernel. I feel that networking would provide a suitable
entry
point for me as I have some networking background. Can any one suggest
where I
need to start to decipher the IP stack implementation in the kernel. 
  
Thanks a lot,
  Regards,
  Aravind.
  

See the information on the linux-net wiki: http://linux-net.osdl.org/index.php/Main_Page.


Read the threads on netdev list. There's a lot of information too.


-- 


--
Best Regards

Alan Menegotto



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Linux networking implementation and packet capture

2007-09-27 Thread Alan Menegotto

Gaurav Aggarwal escreveu:

Hi,

I am trying to understand the implementation of linux 2.4 and linux 
2.6's networking (IPV4) . Can anyone give me some idea/pointers about 
some of the good resources/whitepapers available in the market to 
understand the same. If there is any document that mention the changes 
between the implementation of networking in 2.4  2.6


I am also trying to write a simple program(preferably a userspace 
application) which captures all the incoming and outgoing packets of a 
particular machine (preferably at PREROUTING stage), then according to 
the SRC/DST addresses, changes the IP address of some of the packets 
and then reinject it back into the local IP stack. I am able to do 
that in 2.4 kernel by using libipq and ip_tables but that prog is not 
running in 2.6 kernel. (It hits at ip_route_BUG). Any idea or code 
snippet will be really appreciated.


--
Regards,
Gaurav Aggarwal

You may also see the information on the linux-net wiki: 
http://linux-net.osdl.org/index.php/Main_Page.


Also, read some threads on netdev list. It has a lot of information 
there too.






--


--
Best Regards

Alan Menegotto


--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: mounted partitions and use

2007-09-18 Thread Alan Menegotto

David Santos escreveu:

Hi, im triying to make a lkm that check mounted partitions and if anyone
of this partitios hace 90% used send a signal to dmesg (printk...).
Someone know any api or library from where i would take this info from
the system?

Thanks.

  
Why code this in kernelspace when you have all the tools in userspace to 
do this?


--


--
Best Regards

Alan Menegotto


--
To unsubscribe from this list: send an email with
unsubscribe kernelnewbies to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ