110923SN/A/*
210923SN/A * Copyright (c) 2015 ARM Limited
310923SN/A * All rights reserved
410923SN/A *
510923SN/A * The license below extends only to copyright in the software and shall
610923SN/A * not be construed as granting a license to any other intellectual
710923SN/A * property including but not limited to intellectual property relating
810923SN/A * to a hardware implementation of the functionality of the software
910923SN/A * licensed hereunder.  You may use the software subject to the license
1010923SN/A * terms below provided that you ensure that this notice is replicated
1110923SN/A * unmodified and in its entirety in all distributions of the software,
1210923SN/A * modified or unmodified, in source code or in binary form.
1310923SN/A *
1410923SN/A * Redistribution and use in source and binary forms, with or without
1510923SN/A * modification, are permitted provided that the following conditions are
1610923SN/A * met: redistributions of source code must retain the above copyright
1710923SN/A * notice, this list of conditions and the following disclaimer;
1810923SN/A * redistributions in binary form must reproduce the above copyright
1910923SN/A * notice, this list of conditions and the following disclaimer in the
2010923SN/A * documentation and/or other materials provided with the distribution;
2110923SN/A * neither the name of the copyright holders nor the names of its
2210923SN/A * contributors may be used to endorse or promote products derived from
2310923SN/A * this software without specific prior written permission.
2410923SN/A *
2510923SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2610923SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2710923SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2810923SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2910923SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3010923SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3110923SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3210923SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3310923SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3410923SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3510923SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3610923SN/A *
3710923SN/A * Authors: Gabor Dozsa
3810923SN/A */
3910923SN/A
4010923SN/A/* @file
4111290Sgabor.dozsa@arm.com * Header packet class for dist-gem5 runs.
4210923SN/A *
4311290Sgabor.dozsa@arm.com * For a high level description about dist-gem5 see comments in
4411290Sgabor.dozsa@arm.com * header file dist_iface.hh.
4510923SN/A *
4611290Sgabor.dozsa@arm.com * The DistHeaderPkt class defines the format of message headers
4711290Sgabor.dozsa@arm.com * sent among gem5 processes during a dist gem5 simulation. A header packet
4810923SN/A * can either carry the description of data packet (i.e. a simulated Ethernet
4910923SN/A * packet) or a synchronisation related control command. In case of
5010923SN/A * data packet description, the corresponding data packet always follows
5110923SN/A * the header packet back-to-back.
5210923SN/A */
5311290Sgabor.dozsa@arm.com#ifndef __DEV_DIST_PACKET_HH__
5411290Sgabor.dozsa@arm.com#define __DEV_DIST_PACKET_HH__
5510923SN/A
5610923SN/A#include <cstring>
5710923SN/A
5810923SN/A#include "base/types.hh"
5910923SN/A
6011290Sgabor.dozsa@arm.comclass DistHeaderPkt
6110923SN/A{
6210923SN/A  private:
6311290Sgabor.dozsa@arm.com    DistHeaderPkt() {}
6411290Sgabor.dozsa@arm.com    ~DistHeaderPkt() {}
6510923SN/A
6610923SN/A  public:
6711290Sgabor.dozsa@arm.com    enum class ReqType { immediate, collective, pending, none };
6810923SN/A    /**
6911290Sgabor.dozsa@arm.com     *  The msg type defines what information a dist header packet carries.
7010923SN/A     */
7110923SN/A    enum class MsgType
7210923SN/A    {
7310923SN/A        dataDescriptor,
7411290Sgabor.dozsa@arm.com        cmdSyncReq,
7511290Sgabor.dozsa@arm.com        cmdSyncAck,
7610923SN/A        unknown
7710923SN/A    };
7810923SN/A
7910923SN/A    struct Header
8010923SN/A    {
8110923SN/A        /**
8211290Sgabor.dozsa@arm.com         * The msg type field is valid for all header packets.
8311290Sgabor.dozsa@arm.com         *
8411290Sgabor.dozsa@arm.com         * @note senderRank is used with data packets while collFlags are used
8511290Sgabor.dozsa@arm.com         * by sync ack messages to trigger collective ckpt or exit events.
8610923SN/A         */
8710923SN/A        MsgType msgType;
8810923SN/A        Tick sendTick;
8911701Smichael.lebeane@amd.com        /**
9011701Smichael.lebeane@amd.com         * Length used for modeling timing in the simulator.
9111701Smichael.lebeane@amd.com         * (from EthPacketData::simLength).
9211701Smichael.lebeane@amd.com         */
9311701Smichael.lebeane@amd.com        unsigned simLength;
9411290Sgabor.dozsa@arm.com        union {
9511290Sgabor.dozsa@arm.com            Tick sendDelay;
9611290Sgabor.dozsa@arm.com            Tick syncRepeat;
9711290Sgabor.dozsa@arm.com        };
9811290Sgabor.dozsa@arm.com        union {
9911290Sgabor.dozsa@arm.com            /**
10011290Sgabor.dozsa@arm.com             * Actual length of the simulated Ethernet packet.
10111701Smichael.lebeane@amd.com             * (from EthPacketData::length).
10211290Sgabor.dozsa@arm.com             */
10311290Sgabor.dozsa@arm.com            unsigned dataPacketLength;
10411290Sgabor.dozsa@arm.com            struct {
10511290Sgabor.dozsa@arm.com                ReqType needCkpt;
10611703Smichael.lebeane@amd.com                ReqType needStopSync;
10711290Sgabor.dozsa@arm.com                ReqType needExit;
10811290Sgabor.dozsa@arm.com            };
10911290Sgabor.dozsa@arm.com        };
11010923SN/A    };
11110923SN/A};
11210923SN/A
11311290Sgabor.dozsa@arm.com#endif
114