Re: Load Balancing for AF_INET Raw Sockets

2015-12-17 Thread Prashant Upadhyaya
On Tue, Dec 15, 2015 at 6:26 PM, Prashant Upadhyaya
 wrote:
> Hi,
>
> I open a raw socket for listening to all the UDP packets in a raw fashion --
>
> socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
>
> Then I use recvfrom to read the packets over the socket.
>
> The above works mighty fine.
> I want to find out if it is possible to 'load balance' the UDP flows
> by opening up multiple instances of this socket and then possibly
> setting some socket options so that I can scale up the reading via
> multiple threads doing recvfrom on these from multiple cores.
> (I know it is possible over packet sockets, but that is a different usecase)
>
> Regards
> -Prashant

ah, the msg_name field in msghdr should do the trick for src address.
--
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: Load Balancing for AF_INET Raw Sockets

2015-12-17 Thread Eric Dumazet
On Thu, 2015-12-17 at 11:40 +0530, Prashant Upadhyaya wrote:
> On Tue, Dec 15, 2015 at 8:09 PM, Eric Dumazet  wrote:
> > On Tue, 2015-12-15 at 18:26 +0530, Prashant Upadhyaya wrote:
> >> Hi,
> >>
> >> I open a raw socket for listening to all the UDP packets in a raw fashion 
> >> --
> >>
> >> socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
> >>
> >> Then I use recvfrom to read the packets over the socket.
> >>
> >> The above works mighty fine.
> >> I want to find out if it is possible to 'load balance' the UDP flows
> >> by opening up multiple instances of this socket and then possibly
> >> setting some socket options so that I can scale up the reading via
> >> multiple threads doing recvfrom on these from multiple cores.
> >> (I know it is possible over packet sockets, but that is a different 
> >> usecase)
> >
> > No plan yet to support fanout on multiple raw sockets.
> >
> >
> Hi,
> 
> One question on the AF_INET6 raw sockets.
> Here I don't get the ipv6 header at all when I read a packet.
> I checked the RFC 3542 and it specifies the following as the ancillary
> data which can be obtained --
> 
> Four similar pieces of information can be returned for a received
>packet as ancillary data:
> 
>   1.  the destination IPv6 address,
>   2.  the arriving interface index,
>   3.  the arriving hop limit, and
>   4.  the arriving traffic class value.
> 
> Now how do I obtain the 'src IPv6 address' ?

man recvfrom



--
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: Load Balancing for AF_INET Raw Sockets

2015-12-16 Thread Prashant Upadhyaya
On Tue, Dec 15, 2015 at 8:09 PM, Eric Dumazet  wrote:
> On Tue, 2015-12-15 at 18:26 +0530, Prashant Upadhyaya wrote:
>> Hi,
>>
>> I open a raw socket for listening to all the UDP packets in a raw fashion --
>>
>> socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
>>
>> Then I use recvfrom to read the packets over the socket.
>>
>> The above works mighty fine.
>> I want to find out if it is possible to 'load balance' the UDP flows
>> by opening up multiple instances of this socket and then possibly
>> setting some socket options so that I can scale up the reading via
>> multiple threads doing recvfrom on these from multiple cores.
>> (I know it is possible over packet sockets, but that is a different usecase)
>
> No plan yet to support fanout on multiple raw sockets.
>
>
Hi,

One question on the AF_INET6 raw sockets.
Here I don't get the ipv6 header at all when I read a packet.
I checked the RFC 3542 and it specifies the following as the ancillary
data which can be obtained --

Four similar pieces of information can be returned for a received
   packet as ancillary data:

  1.  the destination IPv6 address,
  2.  the arriving interface index,
  3.  the arriving hop limit, and
  4.  the arriving traffic class value.

Now how do I obtain the 'src IPv6 address' ?

Regards
-Prashant
--
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: Load Balancing for AF_INET Raw Sockets

2015-12-15 Thread Eric Dumazet
On Tue, 2015-12-15 at 18:26 +0530, Prashant Upadhyaya wrote:
> Hi,
> 
> I open a raw socket for listening to all the UDP packets in a raw fashion --
> 
> socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
> 
> Then I use recvfrom to read the packets over the socket.
> 
> The above works mighty fine.
> I want to find out if it is possible to 'load balance' the UDP flows
> by opening up multiple instances of this socket and then possibly
> setting some socket options so that I can scale up the reading via
> multiple threads doing recvfrom on these from multiple cores.
> (I know it is possible over packet sockets, but that is a different usecase)

No plan yet to support fanout on multiple raw sockets.


--
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