Lines Matching +full:channel +full:- +full:0

3  * Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
5 * Copyright (c) 2013-2014, Qualcomm Atheros, Inc.
48 #define TCI_ES 0x40
49 #define TCI_SC 0x20
50 #define TCI_SCB 0x10
51 #define TCI_E 0x08
52 #define TCI_C 0x04
87 int ret = 0; in __macsec_drv_init()
91 wpa_printf(MSG_INFO, "%s: secy_id=%d", __func__, drv->secy_id); in __macsec_drv_init()
94 ret = nss_macsec_secy_en_set(drv->secy_id, true); in __macsec_drv_init()
98 ret = nss_macsec_secy_sc_sa_mapping_mode_set(drv->secy_id, in __macsec_drv_init()
104 os_memset(&rx_ctl_filt, 0, sizeof(rx_ctl_filt)); in __macsec_drv_init()
107 rx_ctl_filt.match_mask = 0xffff; in __macsec_drv_init()
108 rx_ctl_filt.ether_type_da_range = 0x888e; in __macsec_drv_init()
109 ret = nss_macsec_secy_rx_ctl_filt_set(drv->secy_id, 0, &rx_ctl_filt); in __macsec_drv_init()
113 os_memset(&tx_ctl_filt, 0, sizeof(tx_ctl_filt)); in __macsec_drv_init()
116 tx_ctl_filt.match_mask = 0xffff; in __macsec_drv_init()
117 tx_ctl_filt.ether_type_da_range = 0x888e; in __macsec_drv_init()
118 ret = nss_macsec_secy_tx_ctl_filt_set(drv->secy_id, 0, &tx_ctl_filt); in __macsec_drv_init()
126 nss_macsec_secy_en_set(drv->secy_id, false); in __macsec_drv_deinit()
127 nss_macsec_secy_rx_sc_del_all(drv->secy_id); in __macsec_drv_deinit()
128 nss_macsec_secy_tx_sc_del_all(drv->secy_id); in __macsec_drv_deinit()
153 switch (ntohs(hdr->ethertype)) { in macsec_qca_handle_data()
156 sa = hdr->src; in macsec_qca_handle_data()
157 os_memset(&event, 0, sizeof(event)); in macsec_qca_handle_data()
162 left = len - sizeof(*hdr); in macsec_qca_handle_data()
166 wpa_printf(MSG_DEBUG, "Unknown ethertype 0x%04x in data frame", in macsec_qca_handle_data()
167 ntohs(hdr->ethertype)); in macsec_qca_handle_data()
179 len = recv(sock, buf, sizeof(buf), 0); in macsec_qca_handle_read()
180 if (len < 0) { in macsec_qca_handle_read()
197 drv->common.sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_PAE)); in macsec_qca_init_sockets()
198 if (drv->common.sock < 0) { in macsec_qca_init_sockets()
201 return -1; in macsec_qca_init_sockets()
204 if (eloop_register_read_sock(drv->common.sock, macsec_qca_handle_read, in macsec_qca_init_sockets()
205 drv->common.ctx, NULL)) { in macsec_qca_init_sockets()
207 return -1; in macsec_qca_init_sockets()
210 os_memset(&ifr, 0, sizeof(ifr)); in macsec_qca_init_sockets()
211 os_strlcpy(ifr.ifr_name, drv->common.ifname, sizeof(ifr.ifr_name)); in macsec_qca_init_sockets()
212 if (ioctl(drv->common.sock, SIOCGIFINDEX, &ifr) != 0) { in macsec_qca_init_sockets()
215 return -1; in macsec_qca_init_sockets()
218 os_memset(&addr, 0, sizeof(addr)); in macsec_qca_init_sockets()
224 if (bind(drv->common.sock, (struct sockaddr *) &addr, in macsec_qca_init_sockets()
225 sizeof(addr)) < 0) { in macsec_qca_init_sockets()
227 return -1; in macsec_qca_init_sockets()
231 if (wired_multicast_membership(drv->common.sock, ifr.ifr_ifindex, in macsec_qca_init_sockets()
232 pae_group_addr, 1) < 0) { in macsec_qca_init_sockets()
235 return -1; in macsec_qca_init_sockets()
238 os_memset(&ifr, 0, sizeof(ifr)); in macsec_qca_init_sockets()
239 os_strlcpy(ifr.ifr_name, drv->common.ifname, sizeof(ifr.ifr_name)); in macsec_qca_init_sockets()
240 if (ioctl(drv->common.sock, SIOCGIFHWADDR, &ifr) != 0) { in macsec_qca_init_sockets()
243 return -1; in macsec_qca_init_sockets()
247 wpa_printf(MSG_INFO, "Invalid HW-addr family 0x%04x", in macsec_qca_init_sockets()
249 return -1; in macsec_qca_init_sockets()
253 return 0; in macsec_qca_init_sockets()
255 return -1; in macsec_qca_init_sockets()
267 if (os_strcmp(ifname, "eth2") == 0) { in macsec_qca_secy_id_get()
269 } else if (os_strcmp(ifname, "eth3") == 0) { in macsec_qca_secy_id_get()
271 } else if (os_strcmp(ifname, "eth4") == 0 || in macsec_qca_secy_id_get()
272 os_strcmp(ifname, "eth0") == 0) { in macsec_qca_secy_id_get()
273 *secy_id = 0; in macsec_qca_secy_id_get()
274 } else if (os_strcmp(ifname, "eth5") == 0 || in macsec_qca_secy_id_get()
275 os_strcmp(ifname, "eth1") == 0) { in macsec_qca_secy_id_get()
278 *secy_id = -1; in macsec_qca_secy_id_get()
279 return -1; in macsec_qca_secy_id_get()
282 return 0; in macsec_qca_secy_id_get()
295 if (macsec_qca_secy_id_get(ifname, &drv->secy_id)) { in macsec_qca_init()
302 if (driver_wired_init_common(&drv->common, ifname, ctx) < 0) { in macsec_qca_init()
315 driver_wired_deinit_common(&drv->common); in macsec_qca_deinit()
332 if (macsec_qca_secy_id_get(params->ifname, &drv->secy_id)) { in macsec_qca_hapd_init()
335 params->ifname); in macsec_qca_hapd_init()
340 drv->common.ctx = hapd; in macsec_qca_hapd_init()
341 os_strlcpy(drv->common.ifname, params->ifname, in macsec_qca_hapd_init()
342 sizeof(drv->common.ifname)); in macsec_qca_hapd_init()
343 drv->use_pae_group_addr = params->use_pae_group_addr; in macsec_qca_hapd_init()
345 if (macsec_qca_init_sockets(drv, params->own_addr)) { in macsec_qca_hapd_init()
358 if (drv->common.sock >= 0) { in macsec_qca_hapd_deinit()
359 eloop_unregister_read_sock(drv->common.sock); in macsec_qca_hapd_deinit()
360 close(drv->common.sock); in macsec_qca_hapd_deinit()
383 return -1; in macsec_qca_send_eapol()
386 os_memcpy(hdr->dest, drv->use_pae_group_addr ? pae_group_addr : addr, in macsec_qca_send_eapol()
388 os_memcpy(hdr->src, own_addr, ETH_ALEN); in macsec_qca_send_eapol()
389 hdr->ethertype = htons(ETH_P_PAE); in macsec_qca_send_eapol()
394 res = send(drv->common.sock, (u8 *) hdr, len, 0); in macsec_qca_send_eapol()
397 if (res < 0) { in macsec_qca_send_eapol()
399 "macsec_qca_send_eapol - packet len: %lu - failed: send: %s", in macsec_qca_send_eapol()
411 drv->always_include_sci = params->always_include_sci; in macsec_qca_macsec_init()
412 drv->use_es = params->use_es; in macsec_qca_macsec_init()
413 drv->use_scb = params->use_scb; in macsec_qca_macsec_init()
416 __func__, drv->use_es, drv->use_scb, in macsec_qca_macsec_init()
417 drv->always_include_sci); in macsec_qca_macsec_init()
421 return 0; in macsec_qca_macsec_init()
433 return 0; in macsec_qca_macsec_deinit()
443 return 0; in macsec_qca_get_capability()
450 int ret = 0; in macsec_qca_enable_protect_frames()
454 drv->protect_frames = enabled; in macsec_qca_enable_protect_frames()
464 int ret = 0; in macsec_qca_set_replay_protect()
469 drv->replay_protect = enabled; in macsec_qca_set_replay_protect()
470 drv->replay_window = window; in macsec_qca_set_replay_protect()
495 return -1; in macsec_qca_set_current_cipher_suite()
501 return nss_macsec_secy_cipher_suite_set(drv->secy_id, cs_type); in macsec_qca_set_current_cipher_suite()
508 int ret = 0; in macsec_qca_enable_controlled_port()
512 ret += nss_macsec_secy_controlled_port_en_set(drv->secy_id, enabled); in macsec_qca_enable_controlled_port()
520 u32 *channel) in macsec_qca_lookup_channel() argument
524 for (i = 0; i < MAXSC; i++) { in macsec_qca_lookup_channel()
526 sizeof(struct ieee802_1x_mka_sci)) == 0) { in macsec_qca_lookup_channel()
527 *channel = i; in macsec_qca_lookup_channel()
528 return 0; in macsec_qca_lookup_channel()
532 return -1; in macsec_qca_lookup_channel()
538 u32 channel) in macsec_qca_register_channel() argument
540 os_memcpy(&map[channel].sci, sci, sizeof(struct ieee802_1x_mka_sci)); in macsec_qca_register_channel()
546 u32 *channel) in macsec_qca_lookup_receive_channel() argument
548 return macsec_qca_lookup_channel(drv->receive_channel_map, &sc->sci, in macsec_qca_lookup_receive_channel()
549 channel); in macsec_qca_lookup_receive_channel()
555 u32 channel) in macsec_qca_register_receive_channel() argument
557 macsec_qca_register_channel(drv->receive_channel_map, &sc->sci, in macsec_qca_register_receive_channel()
558 channel); in macsec_qca_register_receive_channel()
564 u32 *channel) in macsec_qca_lookup_transmit_channel() argument
566 return macsec_qca_lookup_channel(drv->transmit_channel_map, &sc->sci, in macsec_qca_lookup_transmit_channel()
567 channel); in macsec_qca_lookup_transmit_channel()
573 u32 channel) in macsec_qca_register_transmit_channel() argument
575 macsec_qca_register_channel(drv->transmit_channel_map, &sc->sci, in macsec_qca_register_transmit_channel()
576 channel); in macsec_qca_register_transmit_channel()
583 int ret = 0; in macsec_qca_get_receive_lowest_pn()
584 u32 next_pn = 0; in macsec_qca_get_receive_lowest_pn()
587 u32 channel; in macsec_qca_get_receive_lowest_pn() local
589 ret = macsec_qca_lookup_receive_channel(priv, sa->sc, &channel); in macsec_qca_get_receive_lowest_pn()
590 if (ret != 0) in macsec_qca_get_receive_lowest_pn()
593 ret += nss_macsec_secy_rx_sa_next_pn_get(drv->secy_id, channel, sa->an, in macsec_qca_get_receive_lowest_pn()
595 ret += nss_macsec_secy_rx_sc_replay_protect_get(drv->secy_id, channel, in macsec_qca_get_receive_lowest_pn()
597 ret += nss_macsec_secy_rx_sc_anti_replay_window_get(drv->secy_id, in macsec_qca_get_receive_lowest_pn()
598 channel, &win); in macsec_qca_get_receive_lowest_pn()
601 sa->lowest_pn = (next_pn > win) ? (next_pn - win) : 1; in macsec_qca_get_receive_lowest_pn()
603 sa->lowest_pn = next_pn; in macsec_qca_get_receive_lowest_pn()
605 wpa_printf(MSG_DEBUG, "%s: lpn=0x%x", __func__, sa->lowest_pn); in macsec_qca_get_receive_lowest_pn()
614 int ret = 0; in macsec_qca_get_transmit_next_pn()
615 u32 channel; in macsec_qca_get_transmit_next_pn() local
617 ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel); in macsec_qca_get_transmit_next_pn()
618 if (ret != 0) in macsec_qca_get_transmit_next_pn()
621 ret += nss_macsec_secy_tx_sa_next_pn_get(drv->secy_id, channel, sa->an, in macsec_qca_get_transmit_next_pn()
622 &sa->next_pn); in macsec_qca_get_transmit_next_pn()
624 wpa_printf(MSG_DEBUG, "%s: npn=0x%x", __func__, sa->next_pn); in macsec_qca_get_transmit_next_pn()
633 int ret = 0; in macsec_qca_set_transmit_next_pn()
634 u32 channel; in macsec_qca_set_transmit_next_pn() local
636 ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel); in macsec_qca_set_transmit_next_pn()
637 if (ret != 0) in macsec_qca_set_transmit_next_pn()
640 ret += nss_macsec_secy_tx_sa_next_pn_set(drv->secy_id, channel, sa->an, in macsec_qca_set_transmit_next_pn()
641 sa->next_pn); in macsec_qca_set_transmit_next_pn()
643 wpa_printf(MSG_INFO, "%s: npn=0x%x", __func__, sa->next_pn); in macsec_qca_set_transmit_next_pn()
649 static int macsec_qca_get_available_receive_sc(void *priv, u32 *channel) in macsec_qca_get_available_receive_sc() argument
652 int ret = 0; in macsec_qca_get_available_receive_sc()
653 u32 sc_ch = 0; in macsec_qca_get_available_receive_sc()
656 for (sc_ch = 0; sc_ch < MAXSC; sc_ch++) { in macsec_qca_get_available_receive_sc()
657 ret = nss_macsec_secy_rx_sc_in_used_get(drv->secy_id, sc_ch, in macsec_qca_get_available_receive_sc()
663 *channel = sc_ch; in macsec_qca_get_available_receive_sc()
664 wpa_printf(MSG_DEBUG, "%s: channel=%d", in macsec_qca_get_available_receive_sc()
665 __func__, *channel); in macsec_qca_get_available_receive_sc()
666 return 0; in macsec_qca_get_available_receive_sc()
670 wpa_printf(MSG_DEBUG, "%s: no available channel", __func__); in macsec_qca_get_available_receive_sc()
672 return -1; in macsec_qca_get_available_receive_sc()
681 int ret = 0; in macsec_qca_create_receive_sc()
685 u32 channel; in macsec_qca_create_receive_sc() local
686 const u8 *sci_addr = sc->sci.addr; in macsec_qca_create_receive_sc()
687 u16 sci_port = be_to_host16(sc->sci.port); in macsec_qca_create_receive_sc()
689 ret = macsec_qca_get_available_receive_sc(priv, &channel); in macsec_qca_create_receive_sc()
690 if (ret != 0) in macsec_qca_create_receive_sc()
693 wpa_printf(MSG_DEBUG, "%s: channel=%d", __func__, channel); in macsec_qca_create_receive_sc()
696 os_memset(&entry, 0, sizeof(entry)); in macsec_qca_create_receive_sc()
699 entry.sci[6] = (sci_port >> 8) & 0xff; in macsec_qca_create_receive_sc()
700 entry.sci[7] = sci_port & 0xff; in macsec_qca_create_receive_sc()
701 entry.sci_mask = 0xf; in macsec_qca_create_receive_sc()
704 entry.channel = channel; in macsec_qca_create_receive_sc()
716 ret += nss_macsec_secy_rx_prc_lut_set(drv->secy_id, channel, &entry); in macsec_qca_create_receive_sc()
717 ret += nss_macsec_secy_rx_sc_create(drv->secy_id, channel); in macsec_qca_create_receive_sc()
718 ret += nss_macsec_secy_rx_sc_validate_frame_set(drv->secy_id, channel, in macsec_qca_create_receive_sc()
720 ret += nss_macsec_secy_rx_sc_replay_protect_set(drv->secy_id, channel, in macsec_qca_create_receive_sc()
721 drv->replay_protect); in macsec_qca_create_receive_sc()
722 ret += nss_macsec_secy_rx_sc_anti_replay_window_set(drv->secy_id, in macsec_qca_create_receive_sc()
723 channel, in macsec_qca_create_receive_sc()
724 drv->replay_window); in macsec_qca_create_receive_sc()
726 macsec_qca_register_receive_channel(drv, sc, channel); in macsec_qca_create_receive_sc()
737 u32 channel; in macsec_qca_delete_receive_sc() local
739 ret = macsec_qca_lookup_receive_channel(priv, sc, &channel); in macsec_qca_delete_receive_sc()
740 if (ret != 0) in macsec_qca_delete_receive_sc()
743 wpa_printf(MSG_DEBUG, "%s: channel=%d", __func__, channel); in macsec_qca_delete_receive_sc()
746 os_memset(&entry, 0, sizeof(entry)); in macsec_qca_delete_receive_sc()
748 ret += nss_macsec_secy_rx_sc_del(drv->secy_id, channel); in macsec_qca_delete_receive_sc()
749 ret += nss_macsec_secy_rx_prc_lut_set(drv->secy_id, channel, &entry); in macsec_qca_delete_receive_sc()
760 int i = 0; in macsec_qca_create_receive_sa()
761 u32 channel; in macsec_qca_create_receive_sa() local
765 ret = macsec_qca_lookup_receive_channel(priv, sa->sc, &channel); in macsec_qca_create_receive_sa()
766 if (ret != 0) in macsec_qca_create_receive_sa()
769 wpa_printf(MSG_DEBUG, "%s, channel=%d, an=%d, lpn=0x%x", in macsec_qca_create_receive_sa()
770 __func__, channel, sa->an, sa->lowest_pn); in macsec_qca_create_receive_sa()
772 os_memset(&rx_sak, 0, sizeof(rx_sak)); in macsec_qca_create_receive_sa()
773 rx_sak.sak_len = sa->pkey->key_len; in macsec_qca_create_receive_sa()
774 if (sa->pkey->key_len == SAK_128_LEN) { in macsec_qca_create_receive_sa()
775 for (i = 0; i < 16; i++) in macsec_qca_create_receive_sa()
776 rx_sak.sak[i] = sa->pkey->key[15 - i]; in macsec_qca_create_receive_sa()
777 } else if (sa->pkey->key_len == SAK_256_LEN) { in macsec_qca_create_receive_sa()
778 for (i = 0; i < 16; i++) { in macsec_qca_create_receive_sa()
779 rx_sak.sak1[i] = sa->pkey->key[15 - i]; in macsec_qca_create_receive_sa()
780 rx_sak.sak[i] = sa->pkey->key[31 - i]; in macsec_qca_create_receive_sa()
783 return -1; in macsec_qca_create_receive_sa()
786 if (sa->pkey->confidentiality_offset == CONFIDENTIALITY_OFFSET_0) in macsec_qca_create_receive_sa()
787 offset = 0; in macsec_qca_create_receive_sa()
788 else if (sa->pkey->confidentiality_offset == CONFIDENTIALITY_OFFSET_30) in macsec_qca_create_receive_sa()
790 else if (sa->pkey->confidentiality_offset == CONFIDENTIALITY_OFFSET_50) in macsec_qca_create_receive_sa()
793 return -1; in macsec_qca_create_receive_sa()
794 ret += nss_macsec_secy_rx_prc_lut_get(drv->secy_id, channel, &entry); in macsec_qca_create_receive_sa()
796 ret += nss_macsec_secy_rx_prc_lut_set(drv->secy_id, channel, &entry); in macsec_qca_create_receive_sa()
797 ret += nss_macsec_secy_rx_sa_create(drv->secy_id, channel, sa->an); in macsec_qca_create_receive_sa()
798 ret += nss_macsec_secy_rx_sak_set(drv->secy_id, channel, sa->an, in macsec_qca_create_receive_sa()
809 u32 channel; in macsec_qca_enable_receive_sa() local
811 ret = macsec_qca_lookup_receive_channel(priv, sa->sc, &channel); in macsec_qca_enable_receive_sa()
812 if (ret != 0) in macsec_qca_enable_receive_sa()
815 wpa_printf(MSG_DEBUG, "%s: channel=%d, an=%d", __func__, channel, in macsec_qca_enable_receive_sa()
816 sa->an); in macsec_qca_enable_receive_sa()
818 ret += nss_macsec_secy_rx_sa_en_set(drv->secy_id, channel, sa->an, in macsec_qca_enable_receive_sa()
829 u32 channel; in macsec_qca_disable_receive_sa() local
831 ret = macsec_qca_lookup_receive_channel(priv, sa->sc, &channel); in macsec_qca_disable_receive_sa()
832 if (ret != 0) in macsec_qca_disable_receive_sa()
835 wpa_printf(MSG_DEBUG, "%s: channel=%d, an=%d", __func__, channel, in macsec_qca_disable_receive_sa()
836 sa->an); in macsec_qca_disable_receive_sa()
838 ret += nss_macsec_secy_rx_sa_en_set(drv->secy_id, channel, sa->an, in macsec_qca_disable_receive_sa()
845 static int macsec_qca_get_available_transmit_sc(void *priv, u32 *channel) in macsec_qca_get_available_transmit_sc() argument
848 u32 sc_ch = 0; in macsec_qca_get_available_transmit_sc()
851 for (sc_ch = 0; sc_ch < MAXSC; sc_ch++) { in macsec_qca_get_available_transmit_sc()
852 if (nss_macsec_secy_tx_sc_in_used_get(drv->secy_id, sc_ch, in macsec_qca_get_available_transmit_sc()
857 *channel = sc_ch; in macsec_qca_get_available_transmit_sc()
858 wpa_printf(MSG_DEBUG, "%s: channel=%d", in macsec_qca_get_available_transmit_sc()
859 __func__, *channel); in macsec_qca_get_available_transmit_sc()
860 return 0; in macsec_qca_get_available_transmit_sc()
864 wpa_printf(MSG_DEBUG, "%s: no available channel", __func__); in macsec_qca_get_available_transmit_sc()
866 return -1; in macsec_qca_get_available_transmit_sc()
877 u32 channel; in macsec_qca_create_transmit_sc() local
878 u16 sci_port = be_to_host16(sc->sci.port); in macsec_qca_create_transmit_sc()
880 ret = macsec_qca_get_available_transmit_sc(priv, &channel); in macsec_qca_create_transmit_sc()
881 if (ret != 0) in macsec_qca_create_transmit_sc()
884 wpa_printf(MSG_DEBUG, "%s: channel=%d", __func__, channel); in macsec_qca_create_transmit_sc()
887 os_memset(&entry, 0, sizeof(entry)); in macsec_qca_create_transmit_sc()
891 entry.channel = channel; in macsec_qca_create_transmit_sc()
893 os_memcpy(psci, sc->sci.addr, ETH_ALEN); in macsec_qca_create_transmit_sc()
894 psci[6] = (sci_port >> 8) & 0xff; in macsec_qca_create_transmit_sc()
895 psci[7] = sci_port & 0xff; in macsec_qca_create_transmit_sc()
897 ret += nss_macsec_secy_tx_class_lut_set(drv->secy_id, channel, &entry); in macsec_qca_create_transmit_sc()
898 ret += nss_macsec_secy_tx_sc_create(drv->secy_id, channel, psci, 8); in macsec_qca_create_transmit_sc()
899 ret += nss_macsec_secy_tx_sc_protect_set(drv->secy_id, channel, in macsec_qca_create_transmit_sc()
900 drv->protect_frames); in macsec_qca_create_transmit_sc()
901 ret += nss_macsec_secy_tx_sc_confidentiality_offset_set(drv->secy_id, in macsec_qca_create_transmit_sc()
902 channel, in macsec_qca_create_transmit_sc()
905 macsec_qca_register_transmit_channel(drv, sc, channel); in macsec_qca_create_transmit_sc()
916 u32 channel; in macsec_qca_delete_transmit_sc() local
918 ret = macsec_qca_lookup_transmit_channel(priv, sc, &channel); in macsec_qca_delete_transmit_sc()
919 if (ret != 0) in macsec_qca_delete_transmit_sc()
922 wpa_printf(MSG_DEBUG, "%s: channel=%d", __func__, channel); in macsec_qca_delete_transmit_sc()
925 os_memset(&entry, 0, sizeof(entry)); in macsec_qca_delete_transmit_sc()
927 ret += nss_macsec_secy_tx_class_lut_set(drv->secy_id, channel, &entry); in macsec_qca_delete_transmit_sc()
928 ret += nss_macsec_secy_tx_sc_del(drv->secy_id, channel); in macsec_qca_delete_transmit_sc()
938 u8 tci = 0; in macsec_qca_create_transmit_sa()
941 u32 channel; in macsec_qca_create_transmit_sa() local
944 ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel); in macsec_qca_create_transmit_sa()
945 if (ret != 0) in macsec_qca_create_transmit_sa()
949 "%s: channel=%d, an=%d, next_pn=0x%x, confidentiality=%d", in macsec_qca_create_transmit_sa()
950 __func__, channel, sa->an, sa->next_pn, sa->confidentiality); in macsec_qca_create_transmit_sa()
952 if (drv->always_include_sci) in macsec_qca_create_transmit_sa()
954 else if (drv->use_es) in macsec_qca_create_transmit_sa()
956 else if (drv->use_scb) in macsec_qca_create_transmit_sa()
959 if (sa->confidentiality) in macsec_qca_create_transmit_sa()
962 os_memset(&tx_sak, 0, sizeof(tx_sak)); in macsec_qca_create_transmit_sa()
963 tx_sak.sak_len = sa->pkey->key_len; in macsec_qca_create_transmit_sa()
964 if (sa->pkey->key_len == SAK_128_LEN) { in macsec_qca_create_transmit_sa()
965 for (i = 0; i < 16; i++) in macsec_qca_create_transmit_sa()
966 tx_sak.sak[i] = sa->pkey->key[15 - i]; in macsec_qca_create_transmit_sa()
967 } else if (sa->pkey->key_len == SAK_256_LEN) { in macsec_qca_create_transmit_sa()
968 for (i = 0; i < 16; i++) { in macsec_qca_create_transmit_sa()
969 tx_sak.sak1[i] = sa->pkey->key[15 - i]; in macsec_qca_create_transmit_sa()
970 tx_sak.sak[i] = sa->pkey->key[31 - i]; in macsec_qca_create_transmit_sa()
973 return -1; in macsec_qca_create_transmit_sa()
976 if (sa->pkey->confidentiality_offset == CONFIDENTIALITY_OFFSET_0) in macsec_qca_create_transmit_sa()
977 offset = 0; in macsec_qca_create_transmit_sa()
978 else if (sa->pkey->confidentiality_offset == CONFIDENTIALITY_OFFSET_30) in macsec_qca_create_transmit_sa()
980 else if (sa->pkey->confidentiality_offset == CONFIDENTIALITY_OFFSET_50) in macsec_qca_create_transmit_sa()
983 return -1; in macsec_qca_create_transmit_sa()
984 ret += nss_macsec_secy_tx_sc_confidentiality_offset_set(drv->secy_id, in macsec_qca_create_transmit_sa()
985 channel, in macsec_qca_create_transmit_sa()
987 ret += nss_macsec_secy_tx_sa_next_pn_set(drv->secy_id, channel, sa->an, in macsec_qca_create_transmit_sa()
988 sa->next_pn); in macsec_qca_create_transmit_sa()
989 ret += nss_macsec_secy_tx_sak_set(drv->secy_id, channel, sa->an, in macsec_qca_create_transmit_sa()
991 ret += nss_macsec_secy_tx_sc_tci_7_2_set(drv->secy_id, channel, in macsec_qca_create_transmit_sa()
993 ret += nss_macsec_secy_tx_sc_an_set(drv->secy_id, channel, sa->an); in macsec_qca_create_transmit_sa()
1003 u32 channel; in macsec_qca_enable_transmit_sa() local
1005 ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel); in macsec_qca_enable_transmit_sa()
1006 if (ret != 0) in macsec_qca_enable_transmit_sa()
1009 wpa_printf(MSG_DEBUG, "%s: channel=%d, an=%d", __func__, channel, in macsec_qca_enable_transmit_sa()
1010 sa->an); in macsec_qca_enable_transmit_sa()
1012 ret += nss_macsec_secy_tx_sa_en_set(drv->secy_id, channel, sa->an, in macsec_qca_enable_transmit_sa()
1023 u32 channel; in macsec_qca_disable_transmit_sa() local
1025 ret = macsec_qca_lookup_transmit_channel(priv, sa->sc, &channel); in macsec_qca_disable_transmit_sa()
1026 if (ret != 0) in macsec_qca_disable_transmit_sa()
1029 wpa_printf(MSG_DEBUG, "%s: channel=%d, an=%d", __func__, channel, in macsec_qca_disable_transmit_sa()
1030 sa->an); in macsec_qca_disable_transmit_sa()
1032 ret += nss_macsec_secy_tx_sa_en_set(drv->secy_id, channel, sa->an, in macsec_qca_disable_transmit_sa()