Lines Matching +full:- +full:p

4  * SPDX-License-Identifier: Apache-2.0
33 /* MAC address of other device - for filtering testing */
43 (void)net_linkaddr_set(&lladst, (const uint8_t *)hdr->dst.addr, in dsa_ll_addr_switch_cb()
44 sizeof(hdr->dst.addr)); in dsa_ll_addr_switch_cb()
62 pd->sock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); in start_slave_port_packet_socket()
63 if (pd->sock < 0) { in start_slave_port_packet_socket()
65 return -errno; in start_slave_port_packet_socket()
71 ret = bind(pd->sock, (const struct sockaddr *)&dst, sizeof(struct sockaddr_ll)); in start_slave_port_packet_socket()
74 return -errno; in start_slave_port_packet_socket()
88 dsa_switch_set_mac_table_entry(user_data->lan[0], &eth_filter_l2_addr_base[0][0], BIT(4), 0, in dsa_lldp()
90 dsa_switch_get_mac_table_entry(user_data->lan[0], tbl_buf, 0); in dsa_lldp()
105 uint8_t *p = &buffer[sizeof(struct net_eth_hdr)]; in dsa_lldp_send() local
106 uint8_t *pb = p; in dsa_lldp_send()
108 lan = ctx->dsa_port_idx; in dsa_lldp_send()
115 memcpy(eth_hdr->src.addr, net_if_get_link_addr(iface)->addr, ETH_ALEN); in dsa_lldp_send()
116 eth_hdr->dst.addr[0] = MCAST_DEST_MAC0; in dsa_lldp_send()
117 eth_hdr->dst.addr[1] = MCAST_DEST_MAC1; in dsa_lldp_send()
118 eth_hdr->dst.addr[2] = MCAST_DEST_MAC2; in dsa_lldp_send()
119 eth_hdr->dst.addr[3] = MCAST_DEST_MAC3; in dsa_lldp_send()
120 eth_hdr->dst.addr[4] = MCAST_DEST_MAC4; in dsa_lldp_send()
121 eth_hdr->dst.addr[5] = MCAST_DEST_MAC5; in dsa_lldp_send()
124 eth_hdr->type = htons(LLDP_ETHER_TYPE); in dsa_lldp_send()
128 dsa_buf_write_be16((LLDP_TLV_CHASSIS_ID << 9) | (ETH_ALEN + 1), &p); in dsa_lldp_send()
129 *p++ = 4; /* subtype */ in dsa_lldp_send()
130 memcpy(p, net_if_get_link_addr(iface)->addr, ETH_ALEN); in dsa_lldp_send()
131 p += ETH_ALEN; in dsa_lldp_send()
134 dsa_buf_write_be16((LLDP_TLV_PORT_ID << 9) | (ETH_ALEN + 1), &p); in dsa_lldp_send()
135 *p++ = 3; /* subtype */ in dsa_lldp_send()
136 memcpy(p, net_if_get_link_addr(iface)->addr, ETH_ALEN); in dsa_lldp_send()
137 p += ETH_ALEN; in dsa_lldp_send()
140 dsa_buf_write_be16((LLDP_TLV_TTL << 9) | 2, &p); in dsa_lldp_send()
141 *p++ = 0; /* TTL field is 2 bytes long */ in dsa_lldp_send()
142 *p++ = 120; in dsa_lldp_send()
147 dsa_buf_write_be16((LLDP_TLV_SYSTEM_NAME << 9) | strlen(sys_name), &p); in dsa_lldp_send()
148 memcpy(p, sys_name, strlen(sys_name)); in dsa_lldp_send()
149 p += strlen(sys_name); in dsa_lldp_send()
151 len = sizeof(struct net_eth_hdr) + (p - pb); in dsa_lldp_send()
152 ret = sendto(pd->sock, buffer, len, 0, (const struct sockaddr *)&dst, in dsa_lldp_send()
165 uint8_t *p, t1, t2; in dsa_lldp_print_info() local
168 LOG_INF("LLDP pkt recv -> lan%d", lanid); in dsa_lldp_print_info()
170 /* In-buffer data is stored as big endian */ in dsa_lldp_print_info()
184 length--; in dsa_lldp_print_info()
188 p = lldp_p; in dsa_lldp_print_info()
194 LOG_INF("\tCHASSIS ID:\t%02x:%02x:%02x:%02x:%02x:%02x", p[0], p[1], p[2], in dsa_lldp_print_info()
195 p[3], p[4], p[5]); in dsa_lldp_print_info()
198 LOG_INF("\tPORT ID:\t%02x:%02x:%02x:%02x:%02x:%02x", p[0], p[1], p[2], p[3], in dsa_lldp_print_info()
199 p[4], p[5]); in dsa_lldp_print_info()
203 LOG_INF("\tTTL:\t\t%ds", (uint16_t)p[0] << 8 | p[1]); in dsa_lldp_print_info()
207 memcpy(t, p, length); in dsa_lldp_print_info()
219 struct net_eth_hdr *eth_hdr = (struct net_eth_hdr *)pd->recv_buffer; in dsa_lldp_recv()
220 uint8_t *lldp_p = &pd->recv_buffer[sizeof(struct net_eth_hdr)]; in dsa_lldp_recv()
223 *lan = ctx->dsa_port_idx; in dsa_lldp_recv()
226 received = recv(pd->sock, pd->recv_buffer, sizeof(pd->recv_buffer), 0); in dsa_lldp_recv()
229 return -1; in dsa_lldp_recv()
232 if (eth_hdr->type != 0xCC88) { in dsa_lldp_recv()
233 LOG_ERR("Wrong LLDP packet type value [0x%x]", eth_hdr->type); in dsa_lldp_recv()
234 return -1; in dsa_lldp_recv()