Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Jun 2011 23:25:44 +0900
From:      Kazuya Goda <gockzy@gmail.com>
To:        soc-status@freebsd.org
Subject:   [status report] RPS/RFS #week5
Message-ID:  <BANLkTimJLWUR29vfAPRkUg80bJtPFPScWA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,

The project goal is to implement RPS/RFS on FreeBSD. RPS solves the problem of
mono-queue NIC which can't distribute packets across multiple
processors. RFS is
the extension of RPS, which deliver packets to the CPU where
application running.

This week status:

* Implements RFS

** Data Structures
I added two global tables and a entry in struct sockbuf for RFS. These
tables are
"socket_flow_table" and "netisr_flow_table", and entry is flowid.

[ socket_flow_table ]
Structure is below:
unsigned socket_flow_table[SOCKET_FLOW_ENTS];

This table is populated by the recvmsg() call with the CPU ID where
the application is running.
 This value is called "dst cpu".
- operating functions
 +record_dstcpu()    : recorded CPU ID(dst cpu) in soreceive()
 +get_flow_dstcpu() : get "dst cpu" for that flow


[ netisr_flow_table ]
Structure is below:
struct netisr_flow{
        uint16_t cpu;
        unsigned last_qtail;
};
struct netisr_flow netisr_flow_table[NETISR_FLOW_ENTS];

This table contains the most recent CPU used to handle packets for
that connection. This value is called "cur cpu".
- operating functions
 + record_curcpu()    : record CPU ID(cur cpu)
 + get_flow_curcpu() : get "cur cpu" for that flow
 + inc_flow_queue()  : increment netisr_flow_table[index].last_qtail
 + dec_flow_queue() : decrement netisr_flow_table[index].last_qtail
 + get_flow_queue()  : return netisr_flow_table[index].last_qtail

[ entry flowid ]
I added "uint32_t flowid" in struct sockbuf. This entry is populated
by the tcp_input() call with the m->m_pkthdr.flowid.


** Select CPU
The two CPU values(dst cpu, cur cpu) are compared when deciding which
CPU to process the packet on.
The case of "cur cpu" is unset, "dst cpu" is used. The case of two CPU
values are the same, that CPU is used.
But if they are both valid CPU ID, but different, the last_qtail is
consulted. If last_qtail is 0 , "cur cpu" is used.
Other case, "dst cpu" is used.


next week:
* complete implements RFS

Regards,

Kazuya Goda



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTimJLWUR29vfAPRkUg80bJtPFPScWA>