All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sir_ethernet.h
Go to the documentation of this file.
1 /*
2  * ethernet.h
3  *
4  * Created on: Mar 18, 2014
5  * Author: root
6  */
7 
8 #ifndef ETHERNET_H_
9 #define ETHERNET_H_
10 
11 #include <cvmx.h>
12 #include <cvmx-pow.h>
13 #include <cvmx-version.h>
14 #include <common.h>
16 #include "eth/arp-proxy.h"
17 
18 #define MAX_ETH_DEMO_TIME 4ull // Max ETH demo time is 4 hours
19 
20 // Ethernet error codes
21 #define SIR_ETH_OK 0
22 #define SIR_ETH_NOTENOUGHSPACE 1
23 #define SIR_ETH_NOARP 2
24 
26 #pragma pack(push,2)
27 struct TMac
28 {
29  union
30  {
31  struct
32  {
33  uint64_t ui64MAC:48;
34  uint64_t ui64Dummy:16;
35  };
36  struct
37  {
38  uint64_t ui16High:16;
39  uint64_t ui16Med:16;
40  uint64_t ui16Low:16;
41  uint64_t ui16Dummy:16;
42  };
43  };
44 };
45 #pragma pack(pop)
46 
48 {
49  friend class CSirius;
50 public:
51  enum EEthInfo
52  {
53  ETH_ERROR = 0,
54  ETH_OTHER = 1, // not ours
55  ETH_V4 = 2,
56  ETH_V6 = 3,
57  };
58 
59  CSiriusEth(int iPortNr);
60  bool Init(int iInstance);
61  bool DisplayArpStats(int iPortNr);
62  int SendFromIPtoEth(CSiriusMemList *pBuffer, uint16_t ui16VLAN, uint64_t ui64DstMAC, volatile void *pAddr=NULL);
63  EEthInfo HandlePacket(cvmx_wqe_t *pWQE, uint16_t *pui16Vlan, uint16_t *pui16HeaderSize);
64  uint64_t GetMAC(void); // Get MAC address of hardware port
65 
66 private:
67  static void ArpCallback(CARPProxy::TARPEvent *ptArpEvent, void *pArg);
68  uint32_t m_ui32PortNr;
69  TMac m_tMac; // Own MAC Address
70  sir_timer_t m_tMaxETHTime; // Max ethernet time is 4 hours. Used when CAVIUM_DEMO_MODE is defined
71 
72 };
73 
74 #endif /* ETHERNET_H_ */
uint64_t ui16Dummy
Definition: sir_ethernet.h:41
EEthInfo HandlePacket(cvmx_wqe_t *pWQE, uint16_t *pui16Vlan, uint16_t *pui16HeaderSize)
uint64_t ui64MAC
Definition: sir_ethernet.h:33
int SendFromIPtoEth(CSiriusMemList *pBuffer, uint16_t ui16VLAN, uint64_t ui64DstMAC, volatile void *pAddr=NULL)
bool Init(int iInstance)
uint64_t ui16High
Definition: sir_ethernet.h:38
uint64_t ui16Low
Definition: sir_ethernet.h:40
uint64_t GetMAC(void)
uint64_t ui16Med
Definition: sir_ethernet.h:39
uint64_t ui64Dummy
Definition: sir_ethernet.h:34
Define the event events the ARP class generates when calling the ARP callback function void (*PTCallB...
Definition: arp-proxy.h:44
uint64_t sir_timer_t
Sirius main class.
Definition: sir_socket.h:40
MAC address.
Definition: sir_ethernet.h:27
CSiriusEth(int iPortNr)
Most important class of Sirius. Used to maintain and process all kinds of queues. ...
Definition: sir_memlist.h:51
bool DisplayArpStats(int iPortNr)