[ovs-dev] [PATCH] netdev-dpdk: add support for the RTE_ETH_EVENT_INTR_RESET event

Eelco Chaudron echaudro at redhat.com
Tue Sep 10 11:11:12 UTC 2019



On 5 Sep 2019, at 14:40, Ilya Maximets wrote:

> Hi Eelco,

<SNIP>
>> , 2 deletions(-)
>>
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> index bc20d6843..a23150387 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -362,6 +362,7 @@ struct netdev_dpdk {
>>          bool attached;
>>          /* If true, rte_eth_dev_start() was successfully called */
>>          bool started;
>> +        bool reset_needed;
>
> This will produce a hole in the structure as members will no longer
> fit into a single cacheline.  And cacheline markers will be 
> misaligned.
>
> See details for similar issue here:
> https://mail.openvswitch.org/pipermail/ovs-dev/2019-September/362349.html
>
> Possible solution is to turn existing flags into bit fields or stop
> avoiding the problem and drop most of padding in the structure.
>
>
>>          struct eth_addr hwaddr;
>>          int mtu;
>>          int socket_id;

I did a pahole check, as my counting is always off, and it look ok, even 
with the change:

struct netdev_dpdk {
	union {
		OVS_CACHE_LINE_MARKER cacheline0;        /*     0     1 */
		struct {
			dpdk_port_t port_id;             /*     0     2 */
			_Bool      attached;             /*     2     1 */
			_Bool      started;              /*     3     1 */
			_Bool      reset_needed;         /*     4     1 */

			/* XXX 1 byte hole, try to pack */

			struct eth_addr hwaddr;          /*     6     6 */
			int        mtu;                  /*    12     4 */
			int        socket_id;            /*    16     4 */
			int        buf_size;             /*    20     4 */
			int        max_packet_len;       /*    24     4 */
			enum dpdk_dev_type type;         /*    28     4 */
			enum netdev_flags flags;         /*    32     4 */
			int        link_reset_cnt;       /*    36     4 */
			union {
				char * devargs;          /*    40     8 */
				char * vhost_id;         /*    40     8 */
			};                               /*    40     8 */
			struct dpdk_tx_queue * tx_q;     /*    48     8 */
			struct rte_eth_link link;        /*    56     8 */

			/* XXX last struct has 2 bytes of padding */
		};                                       /*     0    64 */
		uint8_t            pad49[64];            /*     0    64 */
	};


<SNIP>


More information about the dev mailing list