Commit 3cc12b5d authored by Yangbo Lu's avatar Yangbo Lu Committed by Benjamin Cabé
Browse files

samples: net: dsa: clang-format dsa_lldp.c



Fixed style problem for dsa_lldp.c with clang-format.

Signed-off-by: default avatarYangbo Lu <yangbo.lu@nxp.com>
parent 3f6413d8
Loading
Loading
Loading
Loading
+15 −19
Original line number Diff line number Diff line
@@ -27,9 +27,8 @@ LOG_MODULE_DECLARE(net_dsa_lldp_sample, CONFIG_NET_DSA_LOG_LEVEL);
#define LLDP_ETHER_TYPE          0x88CC
#define LLDP_INPUT_DATA_BUF_SIZE 512
#define DSA_BUF_SIZ              128
int dsa_lldp_send(struct net_if *iface, struct instance_data *pd,
		  uint16_t lan, int src_port, int origin_port, int cmd,
		  struct eth_addr *origin_addr)
int dsa_lldp_send(struct net_if *iface, struct instance_data *pd, uint16_t lan, int src_port,
		  int origin_port, int cmd, struct eth_addr *origin_addr)
{
	int ret, len;
	char buffer[DSA_BUF_SIZ], sys_name[LLDP_SYSTEM_NAME_SIZE];
@@ -125,12 +124,12 @@ void dsa_lldp_print_info(uint8_t *lldp_p, uint8_t lanid)
		case LLDP_TLV_END_LLDPDU:
			return;
		case LLDP_TLV_CHASSIS_ID:
			LOG_INF("\tCHASSIS ID:\t%02x:%02x:%02x:%02x:%02x:%02x",
				p[0], p[1], p[2], p[3], p[4], p[5]);
			LOG_INF("\tCHASSIS ID:\t%02x:%02x:%02x:%02x:%02x:%02x", p[0], p[1], p[2],
				p[3], p[4], p[5]);
			break;
		case LLDP_TLV_PORT_ID:
			LOG_INF("\tPORT ID:\t%02x:%02x:%02x:%02x:%02x:%02x",
				p[0], p[1], p[2], p[3], p[4], p[5]);
			LOG_INF("\tPORT ID:\t%02x:%02x:%02x:%02x:%02x:%02x", p[0], p[1], p[2], p[3],
				p[4], p[5]);
			break;
		case LLDP_TLV_TTL:
			/* TTL field has 2 bytes in BE */
@@ -146,21 +145,18 @@ void dsa_lldp_print_info(uint8_t *lldp_p, uint8_t lanid)
	} while (1);
}

int dsa_lldp_recv(struct net_if *iface, struct instance_data *pd,
		  uint16_t *lan, int *origin_port,
int dsa_lldp_recv(struct net_if *iface, struct instance_data *pd, uint16_t *lan, int *origin_port,
		  struct eth_addr *origin_addr)
{
	struct ethernet_context *ctx = net_if_l2_data(iface);
	struct net_eth_hdr *eth_hdr =
		(struct net_eth_hdr *) pd->recv_buffer;
	struct net_eth_hdr *eth_hdr = (struct net_eth_hdr *)pd->recv_buffer;
	uint8_t *lldp_p = &pd->recv_buffer[sizeof(struct net_eth_hdr)];
	int received;

	*lan = ctx->dsa_port_idx;

	/* Receive data */
	received = recv(pd->sock, pd->recv_buffer,
			sizeof(pd->recv_buffer), 0);
	received = recv(pd->sock, pd->recv_buffer, sizeof(pd->recv_buffer), 0);
	if (received < 0) {
		LOG_ERR("RAW : recv error %d", errno);
		return -1;