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_multicast.h"
#include "ipv4/ipv4_misc.h"
#include "ipv6/ipv6_misc.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, NetTxAncillary *ancillary)
 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, NetRxAncillary *ancillary)
 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-2024 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
2.4.4

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 53 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 85 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 114 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 145 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 176 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 208 of file nic.c.

◆ nicNotifyLinkChange()

void nicNotifyLinkChange ( NetInterface interface)

Process link state change notification.

Parameters
[in]interfaceUnderlying network interface

Definition at line 559 of file nic.c.

◆ nicProcessPacket()

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

Handle a packet received by the network controller.

Parameters
[in]interfaceUnderlying network interface
[in]packetIncoming packet to process
[in]lengthTotal packet length
[in]ancillaryAdditional options passed to the stack along with the packet

Definition at line 392 of file nic.c.

◆ nicSendPacket()

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

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
[in]ancillaryAdditional options passed to the stack along with the packet
Returns
Error code

Definition at line 281 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 251 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 353 of file nic.c.

Variable Documentation

◆ nicTickCounter

systime_t nicTickCounter

Definition at line 44 of file nic.c.