nic.c File Reference

Network interface controller abstraction layer. More...

#include "core/net.h"
#include "core/nic.h"
#include "core/ethernet.h"
#include "ipv4/ipv4.h"
#include "ipv6/ipv6.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   NIC_TRACE_LEVEL
 

Functions

NetInterfacenicGetLogicalInterface (NetInterface *interface)
 Retrieve logical interface. More...
 
NetInterfacenicGetPhysicalInterface (NetInterface *interface)
 Retrieve physical interface. More...
 
uint8_t nicGetSwitchPort (NetInterface *interface)
 Retrieve switch port identifier. More...
 
uint16_t nicGetVlanId (NetInterface *interface)
 Retrieve VLAN identifier. More...
 
uint16_t nicGetVmanId (NetInterface *interface)
 Retrieve VMAN identifier. More...
 
bool_t nicIsParentInterface (NetInterface *interface, NetInterface *parent)
 Test parent/child relationship between 2 interfaces. More...
 
void nicTick (NetInterface *interface)
 Network controller timer handler. More...
 
error_t nicSendPacket (NetInterface *interface, const NetBuffer *buffer, size_t offset)
 Send a packet to the network controller. More...
 
error_t nicUpdateMacAddrFilter (NetInterface *interface)
 Configure MAC address filtering. More...
 
void nicProcessPacket (NetInterface *interface, uint8_t *packet, size_t length)
 Handle a packet received by the network controller. More...
 
void nicNotifyLinkChange (NetInterface *interface)
 Process link state change notification. More...
 

Variables

systime_t nicTickCounter
 

Detailed Description

Network interface controller abstraction layer.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.6

Definition in file nic.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   NIC_TRACE_LEVEL

Definition at line 32 of file nic.c.

Function Documentation

◆ nicGetLogicalInterface()

NetInterface* nicGetLogicalInterface ( NetInterface interface)

Retrieve logical interface.

Parameters
[in]interfacePointer to the network interface
Returns
Pointer to the physical interface

Definition at line 52 of file nic.c.

◆ nicGetPhysicalInterface()

NetInterface* nicGetPhysicalInterface ( NetInterface interface)

Retrieve physical interface.

Parameters
[in]interfacePointer to the network interface
Returns
Pointer to the physical interface

Definition at line 84 of file nic.c.

◆ nicGetSwitchPort()

uint8_t nicGetSwitchPort ( NetInterface interface)

Retrieve switch port identifier.

Parameters
[in]interfacePointer to the network interface
Returns
Switch port identifier

Definition at line 113 of file nic.c.

◆ nicGetVlanId()

uint16_t nicGetVlanId ( NetInterface interface)

Retrieve VLAN identifier.

Parameters
[in]interfacePointer to the network interface
Returns
VLAN identifier

Definition at line 144 of file nic.c.

◆ nicGetVmanId()

uint16_t nicGetVmanId ( NetInterface interface)

Retrieve VMAN identifier.

Parameters
[in]interfacePointer to the network interface
Returns
VMAN identifier

Definition at line 175 of file nic.c.

◆ nicIsParentInterface()

bool_t nicIsParentInterface ( NetInterface interface,
NetInterface parent 
)

Test parent/child relationship between 2 interfaces.

Parameters
[in]interfacePointer to the child interface
[in]parentPointer to the parent interface
Returns
TRUE is an existing parent/child relationship is found, else FALSE

Definition at line 207 of file nic.c.

◆ nicNotifyLinkChange()

void nicNotifyLinkChange ( NetInterface interface)

Process link state change notification.

Parameters
[in]interfaceUnderlying network interface

Definition at line 525 of file nic.c.

◆ nicProcessPacket()

void nicProcessPacket ( NetInterface interface,
uint8_t *  packet,
size_t  length 
)

Handle a packet received by the network controller.

Parameters
[in]interfaceUnderlying network interface
[in]packetIncoming packet to process
[in]lengthTotal packet length

Definition at line 383 of file nic.c.

◆ nicSendPacket()

error_t nicSendPacket ( NetInterface interface,
const NetBuffer buffer,
size_t  offset 
)

Send a packet to the network controller.

Parameters
[in]interfaceUnderlying network interface
[in]bufferMulti-part buffer containing the data to send
[in]offsetOffset to the first data byte
Returns
Error code

Definition at line 278 of file nic.c.

◆ nicTick()

void nicTick ( NetInterface interface)

Network controller timer handler.

This routine is periodically called by the TCP/IP stack to handle periodic operations such as polling the link state

Parameters
[in]interfaceUnderlying network interface

Definition at line 250 of file nic.c.

◆ nicUpdateMacAddrFilter()

error_t nicUpdateMacAddrFilter ( NetInterface interface)

Configure MAC address filtering.

Parameters
[in]interfaceUnderlying network interface
Returns
Error code

Definition at line 346 of file nic.c.

Variable Documentation

◆ nicTickCounter

systime_t nicTickCounter

Definition at line 43 of file nic.c.