diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-09-28 11:11:16 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-09-28 11:11:16 -0400 |
commit | c487606f835a93a725bac1aefd536be98f22474d (patch) | |
tree | c77571a519905945e24a9ea6e4e44d9032fd527d /include/net | |
parent | d9f72f359e00a45a6cd7cc2d5121b04b9dc927e1 (diff) | |
parent | 97ea6d0f3eb019891038cd2dfddb749d6bf219be (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts:
net/nfc/netlink.c
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/bluetooth/hci.h | 21 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 26 | ||||
-rw-r--r-- | include/net/bluetooth/l2cap.h | 3 | ||||
-rw-r--r-- | include/net/bluetooth/mgmt.h | 16 | ||||
-rw-r--r-- | include/net/cfg80211.h | 25 | ||||
-rw-r--r-- | include/net/mac80211.h | 12 | ||||
-rw-r--r-- | include/net/nfc/hci.h | 21 | ||||
-rw-r--r-- | include/net/nfc/llc.h | 54 | ||||
-rw-r--r-- | include/net/nfc/nci.h | 29 | ||||
-rw-r--r-- | include/net/nfc/nci_core.h | 5 | ||||
-rw-r--r-- | include/net/nfc/nfc.h | 2 | ||||
-rw-r--r-- | include/net/nfc/shdlc.h | 107 |
12 files changed, 188 insertions, 133 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 23cf413e2ac..76b2b6bdcf3 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -302,8 +302,11 @@ enum { | |||
302 | 302 | ||
303 | /* ---- HCI Error Codes ---- */ | 303 | /* ---- HCI Error Codes ---- */ |
304 | #define HCI_ERROR_AUTH_FAILURE 0x05 | 304 | #define HCI_ERROR_AUTH_FAILURE 0x05 |
305 | #define HCI_ERROR_CONNECTION_TIMEOUT 0x08 | ||
305 | #define HCI_ERROR_REJ_BAD_ADDR 0x0f | 306 | #define HCI_ERROR_REJ_BAD_ADDR 0x0f |
306 | #define HCI_ERROR_REMOTE_USER_TERM 0x13 | 307 | #define HCI_ERROR_REMOTE_USER_TERM 0x13 |
308 | #define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14 | ||
309 | #define HCI_ERROR_REMOTE_POWER_OFF 0x15 | ||
307 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 | 310 | #define HCI_ERROR_LOCAL_HOST_TERM 0x16 |
308 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 | 311 | #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 |
309 | 312 | ||
@@ -1246,6 +1249,24 @@ struct hci_ev_simple_pair_complete { | |||
1246 | bdaddr_t bdaddr; | 1249 | bdaddr_t bdaddr; |
1247 | } __packed; | 1250 | } __packed; |
1248 | 1251 | ||
1252 | #define HCI_EV_USER_PASSKEY_NOTIFY 0x3b | ||
1253 | struct hci_ev_user_passkey_notify { | ||
1254 | bdaddr_t bdaddr; | ||
1255 | __le32 passkey; | ||
1256 | } __packed; | ||
1257 | |||
1258 | #define HCI_KEYPRESS_STARTED 0 | ||
1259 | #define HCI_KEYPRESS_ENTERED 1 | ||
1260 | #define HCI_KEYPRESS_ERASED 2 | ||
1261 | #define HCI_KEYPRESS_CLEARED 3 | ||
1262 | #define HCI_KEYPRESS_COMPLETED 4 | ||
1263 | |||
1264 | #define HCI_EV_KEYPRESS_NOTIFY 0x3c | ||
1265 | struct hci_ev_keypress_notify { | ||
1266 | bdaddr_t bdaddr; | ||
1267 | __u8 type; | ||
1268 | } __packed; | ||
1269 | |||
1249 | #define HCI_EV_REMOTE_HOST_FEATURES 0x3d | 1270 | #define HCI_EV_REMOTE_HOST_FEATURES 0x3d |
1250 | struct hci_ev_remote_host_features { | 1271 | struct hci_ev_remote_host_features { |
1251 | bdaddr_t bdaddr; | 1272 | bdaddr_t bdaddr; |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 41d943926d2..e7d45460988 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -303,6 +303,8 @@ struct hci_conn { | |||
303 | __u8 pin_length; | 303 | __u8 pin_length; |
304 | __u8 enc_key_size; | 304 | __u8 enc_key_size; |
305 | __u8 io_capability; | 305 | __u8 io_capability; |
306 | __u32 passkey_notify; | ||
307 | __u8 passkey_entered; | ||
306 | __u16 disc_timeout; | 308 | __u16 disc_timeout; |
307 | unsigned long flags; | 309 | unsigned long flags; |
308 | 310 | ||
@@ -428,15 +430,6 @@ static inline bool hci_conn_ssp_enabled(struct hci_conn *conn) | |||
428 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); | 430 | test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); |
429 | } | 431 | } |
430 | 432 | ||
431 | static inline void hci_conn_hash_init(struct hci_dev *hdev) | ||
432 | { | ||
433 | struct hci_conn_hash *h = &hdev->conn_hash; | ||
434 | INIT_LIST_HEAD(&h->list); | ||
435 | h->acl_num = 0; | ||
436 | h->sco_num = 0; | ||
437 | h->le_num = 0; | ||
438 | } | ||
439 | |||
440 | static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) | 433 | static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) |
441 | { | 434 | { |
442 | struct hci_conn_hash *h = &hdev->conn_hash; | 435 | struct hci_conn_hash *h = &hdev->conn_hash; |
@@ -551,9 +544,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, | |||
551 | return NULL; | 544 | return NULL; |
552 | } | 545 | } |
553 | 546 | ||
554 | void hci_acl_connect(struct hci_conn *conn); | ||
555 | void hci_acl_disconn(struct hci_conn *conn, __u8 reason); | 547 | void hci_acl_disconn(struct hci_conn *conn, __u8 reason); |
556 | void hci_add_sco(struct hci_conn *conn, __u16 handle); | ||
557 | void hci_setup_sync(struct hci_conn *conn, __u16 handle); | 548 | void hci_setup_sync(struct hci_conn *conn, __u16 handle); |
558 | void hci_sco_setup(struct hci_conn *conn, __u8 status); | 549 | void hci_sco_setup(struct hci_conn *conn, __u8 status); |
559 | 550 | ||
@@ -563,7 +554,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev); | |||
563 | void hci_conn_check_pending(struct hci_dev *hdev); | 554 | void hci_conn_check_pending(struct hci_dev *hdev); |
564 | 555 | ||
565 | struct hci_chan *hci_chan_create(struct hci_conn *conn); | 556 | struct hci_chan *hci_chan_create(struct hci_conn *conn); |
566 | int hci_chan_del(struct hci_chan *chan); | 557 | void hci_chan_del(struct hci_chan *chan); |
567 | void hci_chan_list_flush(struct hci_conn *conn); | 558 | void hci_chan_list_flush(struct hci_conn *conn); |
568 | 559 | ||
569 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, | 560 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, |
@@ -614,11 +605,17 @@ static inline void hci_conn_put(struct hci_conn *conn) | |||
614 | /* ----- HCI Devices ----- */ | 605 | /* ----- HCI Devices ----- */ |
615 | static inline void hci_dev_put(struct hci_dev *d) | 606 | static inline void hci_dev_put(struct hci_dev *d) |
616 | { | 607 | { |
608 | BT_DBG("%s orig refcnt %d", d->name, | ||
609 | atomic_read(&d->dev.kobj.kref.refcount)); | ||
610 | |||
617 | put_device(&d->dev); | 611 | put_device(&d->dev); |
618 | } | 612 | } |
619 | 613 | ||
620 | static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) | 614 | static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) |
621 | { | 615 | { |
616 | BT_DBG("%s orig refcnt %d", d->name, | ||
617 | atomic_read(&d->dev.kobj.kref.refcount)); | ||
618 | |||
622 | get_device(&d->dev); | 619 | get_device(&d->dev); |
623 | return d; | 620 | return d; |
624 | } | 621 | } |
@@ -1004,7 +1001,7 @@ int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | |||
1004 | u8 addr_type, u32 flags, u8 *name, u8 name_len, | 1001 | u8 addr_type, u32 flags, u8 *name, u8 name_len, |
1005 | u8 *dev_class); | 1002 | u8 *dev_class); |
1006 | int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, | 1003 | int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, |
1007 | u8 link_type, u8 addr_type); | 1004 | u8 link_type, u8 addr_type, u8 reason); |
1008 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, | 1005 | int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, |
1009 | u8 link_type, u8 addr_type, u8 status); | 1006 | u8 link_type, u8 addr_type, u8 status); |
1010 | int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1007 | int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
@@ -1027,6 +1024,9 @@ int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | |||
1027 | u8 link_type, u8 addr_type, u8 status); | 1024 | u8 link_type, u8 addr_type, u8 status); |
1028 | int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, | 1025 | int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, |
1029 | u8 link_type, u8 addr_type, u8 status); | 1026 | u8 link_type, u8 addr_type, u8 status); |
1027 | int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr, | ||
1028 | u8 link_type, u8 addr_type, u32 passkey, | ||
1029 | u8 entered); | ||
1030 | int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, | 1030 | int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, |
1031 | u8 addr_type, u8 status); | 1031 | u8 addr_type, u8 status); |
1032 | int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); | 1032 | int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index d206296137e..7ed8e356425 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -433,11 +433,10 @@ struct l2cap_chan { | |||
433 | struct sock *sk; | 433 | struct sock *sk; |
434 | 434 | ||
435 | struct l2cap_conn *conn; | 435 | struct l2cap_conn *conn; |
436 | struct kref kref; | ||
436 | 437 | ||
437 | __u8 state; | 438 | __u8 state; |
438 | 439 | ||
439 | atomic_t refcnt; | ||
440 | |||
441 | __le16 psm; | 440 | __le16 psm; |
442 | __u16 dcid; | 441 | __u16 dcid; |
443 | __u16 scid; | 442 | __u16 scid; |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 4348ee8bda6..22980a7c387 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -405,7 +405,16 @@ struct mgmt_ev_device_connected { | |||
405 | __u8 eir[0]; | 405 | __u8 eir[0]; |
406 | } __packed; | 406 | } __packed; |
407 | 407 | ||
408 | #define MGMT_DEV_DISCONN_UNKNOWN 0x00 | ||
409 | #define MGMT_DEV_DISCONN_TIMEOUT 0x01 | ||
410 | #define MGMT_DEV_DISCONN_LOCAL_HOST 0x02 | ||
411 | #define MGMT_DEV_DISCONN_REMOTE 0x03 | ||
412 | |||
408 | #define MGMT_EV_DEVICE_DISCONNECTED 0x000C | 413 | #define MGMT_EV_DEVICE_DISCONNECTED 0x000C |
414 | struct mgmt_ev_device_disconnected { | ||
415 | struct mgmt_addr_info addr; | ||
416 | __u8 reason; | ||
417 | } __packed; | ||
409 | 418 | ||
410 | #define MGMT_EV_CONNECT_FAILED 0x000D | 419 | #define MGMT_EV_CONNECT_FAILED 0x000D |
411 | struct mgmt_ev_connect_failed { | 420 | struct mgmt_ev_connect_failed { |
@@ -469,3 +478,10 @@ struct mgmt_ev_device_unblocked { | |||
469 | struct mgmt_ev_device_unpaired { | 478 | struct mgmt_ev_device_unpaired { |
470 | struct mgmt_addr_info addr; | 479 | struct mgmt_addr_info addr; |
471 | } __packed; | 480 | } __packed; |
481 | |||
482 | #define MGMT_EV_PASSKEY_NOTIFY 0x0017 | ||
483 | struct mgmt_ev_passkey_notify { | ||
484 | struct mgmt_addr_info addr; | ||
485 | __le32 passkey; | ||
486 | __u8 entered; | ||
487 | } __packed; | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index a9a2be78e73..1b498908224 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1580,9 +1580,7 @@ struct cfg80211_gtk_rekey_data { | |||
1580 | * @set_cqm_txe_config: Configure connection quality monitor TX error | 1580 | * @set_cqm_txe_config: Configure connection quality monitor TX error |
1581 | * thresholds. | 1581 | * thresholds. |
1582 | * @sched_scan_start: Tell the driver to start a scheduled scan. | 1582 | * @sched_scan_start: Tell the driver to start a scheduled scan. |
1583 | * @sched_scan_stop: Tell the driver to stop an ongoing scheduled | 1583 | * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. |
1584 | * scan. The driver_initiated flag specifies whether the driver | ||
1585 | * itself has informed that the scan has stopped. | ||
1586 | * | 1584 | * |
1587 | * @mgmt_frame_register: Notify driver that a management frame type was | 1585 | * @mgmt_frame_register: Notify driver that a management frame type was |
1588 | * registered. Note that this callback may not sleep, and cannot run | 1586 | * registered. Note that this callback may not sleep, and cannot run |
@@ -1630,7 +1628,7 @@ struct cfg80211_ops { | |||
1630 | void (*set_wakeup)(struct wiphy *wiphy, bool enabled); | 1628 | void (*set_wakeup)(struct wiphy *wiphy, bool enabled); |
1631 | 1629 | ||
1632 | struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, | 1630 | struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, |
1633 | char *name, | 1631 | const char *name, |
1634 | enum nl80211_iftype type, | 1632 | enum nl80211_iftype type, |
1635 | u32 *flags, | 1633 | u32 *flags, |
1636 | struct vif_params *params); | 1634 | struct vif_params *params); |
@@ -3363,6 +3361,25 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, | |||
3363 | void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); | 3361 | void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); |
3364 | 3362 | ||
3365 | /** | 3363 | /** |
3364 | * cfg80211_conn_failed - connection request failed notification | ||
3365 | * | ||
3366 | * @dev: the netdev | ||
3367 | * @mac_addr: the station's address | ||
3368 | * @reason: the reason for connection failure | ||
3369 | * @gfp: allocation flags | ||
3370 | * | ||
3371 | * Whenever a station tries to connect to an AP and if the station | ||
3372 | * could not connect to the AP as the AP has rejected the connection | ||
3373 | * for some reasons, this function is called. | ||
3374 | * | ||
3375 | * The reason for connection failure can be any of the value from | ||
3376 | * nl80211_connect_failed_reason enum | ||
3377 | */ | ||
3378 | void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, | ||
3379 | enum nl80211_connect_failed_reason reason, | ||
3380 | gfp_t gfp); | ||
3381 | |||
3382 | /** | ||
3366 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame | 3383 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame |
3367 | * @wdev: wireless device receiving the frame | 3384 | * @wdev: wireless device receiving the frame |
3368 | * @freq: Frequency on which the frame was received in MHz | 3385 | * @freq: Frequency on which the frame was received in MHz |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 71f8262fc1d..82558c8decf 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -973,21 +973,29 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
973 | * generation in software. | 973 | * generation in software. |
974 | * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates | 974 | * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates |
975 | * that the key is pairwise rather then a shared key. | 975 | * that the key is pairwise rather then a shared key. |
976 | * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a | 976 | * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a |
977 | * CCMP key if it requires CCMP encryption of management frames (MFP) to | 977 | * CCMP key if it requires CCMP encryption of management frames (MFP) to |
978 | * be done in software. | 978 | * be done in software. |
979 | * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver | 979 | * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver |
980 | * if space should be prepared for the IV, but the IV | 980 | * if space should be prepared for the IV, but the IV |
981 | * itself should not be generated. Do not set together with | 981 | * itself should not be generated. Do not set together with |
982 | * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. | 982 | * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. |
983 | * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received | ||
984 | * management frames. The flag can help drivers that have a hardware | ||
985 | * crypto implementation that doesn't deal with management frames | ||
986 | * properly by allowing them to not upload the keys to hardware and | ||
987 | * fall back to software crypto. Note that this flag deals only with | ||
988 | * RX, if your crypto engine can't deal with TX you can also set the | ||
989 | * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW. | ||
983 | */ | 990 | */ |
984 | enum ieee80211_key_flags { | 991 | enum ieee80211_key_flags { |
985 | IEEE80211_KEY_FLAG_WMM_STA = 1<<0, | 992 | IEEE80211_KEY_FLAG_WMM_STA = 1<<0, |
986 | IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, | 993 | IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, |
987 | IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, | 994 | IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, |
988 | IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, | 995 | IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, |
989 | IEEE80211_KEY_FLAG_SW_MGMT = 1<<4, | 996 | IEEE80211_KEY_FLAG_SW_MGMT_TX = 1<<4, |
990 | IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, | 997 | IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, |
998 | IEEE80211_KEY_FLAG_RX_MGMT = 1<<6, | ||
991 | }; | 999 | }; |
992 | 1000 | ||
993 | /** | 1001 | /** |
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h index f5169b04f08..e900072950c 100644 --- a/include/net/nfc/hci.h +++ b/include/net/nfc/hci.h | |||
@@ -30,6 +30,11 @@ struct nfc_hci_ops { | |||
30 | int (*open) (struct nfc_hci_dev *hdev); | 30 | int (*open) (struct nfc_hci_dev *hdev); |
31 | void (*close) (struct nfc_hci_dev *hdev); | 31 | void (*close) (struct nfc_hci_dev *hdev); |
32 | int (*hci_ready) (struct nfc_hci_dev *hdev); | 32 | int (*hci_ready) (struct nfc_hci_dev *hdev); |
33 | /* | ||
34 | * xmit must always send the complete buffer before | ||
35 | * returning. Returned result must be 0 for success | ||
36 | * or negative for failure. | ||
37 | */ | ||
33 | int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb); | 38 | int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb); |
34 | int (*start_poll) (struct nfc_hci_dev *hdev, | 39 | int (*start_poll) (struct nfc_hci_dev *hdev, |
35 | u32 im_protocols, u32 tm_protocols); | 40 | u32 im_protocols, u32 tm_protocols); |
@@ -38,8 +43,8 @@ struct nfc_hci_ops { | |||
38 | int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate, | 43 | int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate, |
39 | struct nfc_target *target); | 44 | struct nfc_target *target); |
40 | int (*data_exchange) (struct nfc_hci_dev *hdev, | 45 | int (*data_exchange) (struct nfc_hci_dev *hdev, |
41 | struct nfc_target *target, | 46 | struct nfc_target *target, struct sk_buff *skb, |
42 | struct sk_buff *skb, struct sk_buff **res_skb); | 47 | data_exchange_cb_t cb, void *cb_context); |
43 | int (*check_presence)(struct nfc_hci_dev *hdev, | 48 | int (*check_presence)(struct nfc_hci_dev *hdev, |
44 | struct nfc_target *target); | 49 | struct nfc_target *target); |
45 | }; | 50 | }; |
@@ -74,7 +79,6 @@ struct nfc_hci_dev { | |||
74 | 79 | ||
75 | struct list_head msg_tx_queue; | 80 | struct list_head msg_tx_queue; |
76 | 81 | ||
77 | struct workqueue_struct *msg_tx_wq; | ||
78 | struct work_struct msg_tx_work; | 82 | struct work_struct msg_tx_work; |
79 | 83 | ||
80 | struct timer_list cmd_timer; | 84 | struct timer_list cmd_timer; |
@@ -82,13 +86,14 @@ struct nfc_hci_dev { | |||
82 | 86 | ||
83 | struct sk_buff_head rx_hcp_frags; | 87 | struct sk_buff_head rx_hcp_frags; |
84 | 88 | ||
85 | struct workqueue_struct *msg_rx_wq; | ||
86 | struct work_struct msg_rx_work; | 89 | struct work_struct msg_rx_work; |
87 | 90 | ||
88 | struct sk_buff_head msg_rx_queue; | 91 | struct sk_buff_head msg_rx_queue; |
89 | 92 | ||
90 | struct nfc_hci_ops *ops; | 93 | struct nfc_hci_ops *ops; |
91 | 94 | ||
95 | struct nfc_llc *llc; | ||
96 | |||
92 | struct nfc_hci_init_data init_data; | 97 | struct nfc_hci_init_data init_data; |
93 | 98 | ||
94 | void *clientdata; | 99 | void *clientdata; |
@@ -105,12 +110,17 @@ struct nfc_hci_dev { | |||
105 | u8 hw_mpw; | 110 | u8 hw_mpw; |
106 | u8 hw_software; | 111 | u8 hw_software; |
107 | u8 hw_bsid; | 112 | u8 hw_bsid; |
113 | |||
114 | int async_cb_type; | ||
115 | data_exchange_cb_t async_cb; | ||
116 | void *async_cb_context; | ||
108 | }; | 117 | }; |
109 | 118 | ||
110 | /* hci device allocation */ | 119 | /* hci device allocation */ |
111 | struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops, | 120 | struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops, |
112 | struct nfc_hci_init_data *init_data, | 121 | struct nfc_hci_init_data *init_data, |
113 | u32 protocols, | 122 | u32 protocols, |
123 | const char *llc_name, | ||
114 | int tx_headroom, | 124 | int tx_headroom, |
115 | int tx_tailroom, | 125 | int tx_tailroom, |
116 | int max_link_payload); | 126 | int max_link_payload); |
@@ -202,6 +212,9 @@ int nfc_hci_set_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx, | |||
202 | const u8 *param, size_t param_len); | 212 | const u8 *param, size_t param_len); |
203 | int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, | 213 | int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, |
204 | const u8 *param, size_t param_len, struct sk_buff **skb); | 214 | const u8 *param, size_t param_len, struct sk_buff **skb); |
215 | int nfc_hci_send_cmd_async(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, | ||
216 | const u8 *param, size_t param_len, | ||
217 | data_exchange_cb_t cb, void *cb_context); | ||
205 | int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response, | 218 | int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response, |
206 | const u8 *param, size_t param_len); | 219 | const u8 *param, size_t param_len); |
207 | int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event, | 220 | int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event, |
diff --git a/include/net/nfc/llc.h b/include/net/nfc/llc.h new file mode 100644 index 00000000000..400ab7ae749 --- /dev/null +++ b/include/net/nfc/llc.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * Link Layer Control manager public interface | ||
3 | * | ||
4 | * Copyright (C) 2012 Intel Corporation. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the | ||
17 | * Free Software Foundation, Inc., | ||
18 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef __NFC_LLC_H_ | ||
22 | #define __NFC_LLC_H_ | ||
23 | |||
24 | #include <net/nfc/hci.h> | ||
25 | #include <linux/skbuff.h> | ||
26 | |||
27 | #define LLC_NOP_NAME "nop" | ||
28 | #define LLC_SHDLC_NAME "shdlc" | ||
29 | |||
30 | typedef void (*rcv_to_hci_t) (struct nfc_hci_dev *hdev, struct sk_buff *skb); | ||
31 | typedef int (*xmit_to_drv_t) (struct nfc_hci_dev *hdev, struct sk_buff *skb); | ||
32 | typedef void (*llc_failure_t) (struct nfc_hci_dev *hdev, int err); | ||
33 | |||
34 | struct nfc_llc; | ||
35 | |||
36 | struct nfc_llc *nfc_llc_allocate(const char *name, struct nfc_hci_dev *hdev, | ||
37 | xmit_to_drv_t xmit_to_drv, | ||
38 | rcv_to_hci_t rcv_to_hci, int tx_headroom, | ||
39 | int tx_tailroom, llc_failure_t llc_failure); | ||
40 | void nfc_llc_free(struct nfc_llc *llc); | ||
41 | |||
42 | void nfc_llc_get_rx_head_tail_room(struct nfc_llc *llc, int *rx_headroom, | ||
43 | int *rx_tailroom); | ||
44 | |||
45 | |||
46 | int nfc_llc_start(struct nfc_llc *llc); | ||
47 | int nfc_llc_stop(struct nfc_llc *llc); | ||
48 | void nfc_llc_rcv_from_drv(struct nfc_llc *llc, struct sk_buff *skb); | ||
49 | int nfc_llc_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb); | ||
50 | |||
51 | int nfc_llc_init(void); | ||
52 | void nfc_llc_exit(void); | ||
53 | |||
54 | #endif /* __NFC_LLC_H_ */ | ||
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h index 276094b91d7..88785e5c6b2 100644 --- a/include/net/nfc/nci.h +++ b/include/net/nfc/nci.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #define NCI_MAX_NUM_MAPPING_CONFIGS 10 | 32 | #define NCI_MAX_NUM_MAPPING_CONFIGS 10 |
33 | #define NCI_MAX_NUM_RF_CONFIGS 10 | 33 | #define NCI_MAX_NUM_RF_CONFIGS 10 |
34 | #define NCI_MAX_NUM_CONN 10 | 34 | #define NCI_MAX_NUM_CONN 10 |
35 | #define NCI_MAX_PARAM_LEN 251 | ||
35 | 36 | ||
36 | /* NCI Status Codes */ | 37 | /* NCI Status Codes */ |
37 | #define NCI_STATUS_OK 0x00 | 38 | #define NCI_STATUS_OK 0x00 |
@@ -102,6 +103,9 @@ | |||
102 | #define NCI_RF_INTERFACE_ISO_DEP 0x02 | 103 | #define NCI_RF_INTERFACE_ISO_DEP 0x02 |
103 | #define NCI_RF_INTERFACE_NFC_DEP 0x03 | 104 | #define NCI_RF_INTERFACE_NFC_DEP 0x03 |
104 | 105 | ||
106 | /* NCI Configuration Parameter Tags */ | ||
107 | #define NCI_PN_ATR_REQ_GEN_BYTES 0x29 | ||
108 | |||
105 | /* NCI Reset types */ | 109 | /* NCI Reset types */ |
106 | #define NCI_RESET_TYPE_KEEP_CONFIG 0x00 | 110 | #define NCI_RESET_TYPE_KEEP_CONFIG 0x00 |
107 | #define NCI_RESET_TYPE_RESET_CONFIG 0x01 | 111 | #define NCI_RESET_TYPE_RESET_CONFIG 0x01 |
@@ -188,6 +192,18 @@ struct nci_core_reset_cmd { | |||
188 | 192 | ||
189 | #define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01) | 193 | #define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01) |
190 | 194 | ||
195 | #define NCI_OP_CORE_SET_CONFIG_CMD nci_opcode_pack(NCI_GID_CORE, 0x02) | ||
196 | struct set_config_param { | ||
197 | __u8 id; | ||
198 | __u8 len; | ||
199 | __u8 val[NCI_MAX_PARAM_LEN]; | ||
200 | } __packed; | ||
201 | |||
202 | struct nci_core_set_config_cmd { | ||
203 | __u8 num_params; | ||
204 | struct set_config_param param; /* support 1 param per cmd is enough */ | ||
205 | } __packed; | ||
206 | |||
191 | #define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) | 207 | #define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) |
192 | struct disc_map_config { | 208 | struct disc_map_config { |
193 | __u8 rf_protocol; | 209 | __u8 rf_protocol; |
@@ -252,6 +268,13 @@ struct nci_core_init_rsp_2 { | |||
252 | __le32 manufact_specific_info; | 268 | __le32 manufact_specific_info; |
253 | } __packed; | 269 | } __packed; |
254 | 270 | ||
271 | #define NCI_OP_CORE_SET_CONFIG_RSP nci_opcode_pack(NCI_GID_CORE, 0x02) | ||
272 | struct nci_core_set_config_rsp { | ||
273 | __u8 status; | ||
274 | __u8 num_params; | ||
275 | __u8 params_id[0]; /* variable size array */ | ||
276 | } __packed; | ||
277 | |||
255 | #define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) | 278 | #define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) |
256 | 279 | ||
257 | #define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) | 280 | #define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) |
@@ -328,6 +351,11 @@ struct activation_params_nfcb_poll_iso_dep { | |||
328 | __u8 attrib_res[50]; | 351 | __u8 attrib_res[50]; |
329 | }; | 352 | }; |
330 | 353 | ||
354 | struct activation_params_poll_nfc_dep { | ||
355 | __u8 atr_res_len; | ||
356 | __u8 atr_res[63]; | ||
357 | }; | ||
358 | |||
331 | struct nci_rf_intf_activated_ntf { | 359 | struct nci_rf_intf_activated_ntf { |
332 | __u8 rf_discovery_id; | 360 | __u8 rf_discovery_id; |
333 | __u8 rf_interface; | 361 | __u8 rf_interface; |
@@ -351,6 +379,7 @@ struct nci_rf_intf_activated_ntf { | |||
351 | union { | 379 | union { |
352 | struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; | 380 | struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; |
353 | struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; | 381 | struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; |
382 | struct activation_params_poll_nfc_dep poll_nfc_dep; | ||
354 | } activation_params; | 383 | } activation_params; |
355 | 384 | ||
356 | } __packed; | 385 | } __packed; |
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h index feba74027ff..d705d867494 100644 --- a/include/net/nfc/nci_core.h +++ b/include/net/nfc/nci_core.h | |||
@@ -54,6 +54,7 @@ enum nci_state { | |||
54 | /* NCI timeouts */ | 54 | /* NCI timeouts */ |
55 | #define NCI_RESET_TIMEOUT 5000 | 55 | #define NCI_RESET_TIMEOUT 5000 |
56 | #define NCI_INIT_TIMEOUT 5000 | 56 | #define NCI_INIT_TIMEOUT 5000 |
57 | #define NCI_SET_CONFIG_TIMEOUT 5000 | ||
57 | #define NCI_RF_DISC_TIMEOUT 5000 | 58 | #define NCI_RF_DISC_TIMEOUT 5000 |
58 | #define NCI_RF_DISC_SELECT_TIMEOUT 5000 | 59 | #define NCI_RF_DISC_SELECT_TIMEOUT 5000 |
59 | #define NCI_RF_DEACTIVATE_TIMEOUT 30000 | 60 | #define NCI_RF_DEACTIVATE_TIMEOUT 30000 |
@@ -137,6 +138,10 @@ struct nci_dev { | |||
137 | data_exchange_cb_t data_exchange_cb; | 138 | data_exchange_cb_t data_exchange_cb; |
138 | void *data_exchange_cb_context; | 139 | void *data_exchange_cb_context; |
139 | struct sk_buff *rx_data_reassembly; | 140 | struct sk_buff *rx_data_reassembly; |
141 | |||
142 | /* stored during intf_activated_ntf */ | ||
143 | __u8 remote_gb[NFC_MAX_GT_LEN]; | ||
144 | __u8 remote_gb_len; | ||
140 | }; | 145 | }; |
141 | 146 | ||
142 | /* ----- NCI Devices ----- */ | 147 | /* ----- NCI Devices ----- */ |
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 6735909f826..f05b10682c9 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h | |||
@@ -72,6 +72,7 @@ struct nfc_ops { | |||
72 | 72 | ||
73 | #define NFC_TARGET_IDX_ANY -1 | 73 | #define NFC_TARGET_IDX_ANY -1 |
74 | #define NFC_MAX_GT_LEN 48 | 74 | #define NFC_MAX_GT_LEN 48 |
75 | #define NFC_ATR_RES_GT_OFFSET 15 | ||
75 | 76 | ||
76 | struct nfc_target { | 77 | struct nfc_target { |
77 | u32 idx; | 78 | u32 idx; |
@@ -112,7 +113,6 @@ struct nfc_dev { | |||
112 | int tx_tailroom; | 113 | int tx_tailroom; |
113 | 114 | ||
114 | struct timer_list check_pres_timer; | 115 | struct timer_list check_pres_timer; |
115 | struct workqueue_struct *check_pres_wq; | ||
116 | struct work_struct check_pres_work; | 116 | struct work_struct check_pres_work; |
117 | 117 | ||
118 | struct nfc_ops *ops; | 118 | struct nfc_ops *ops; |
diff --git a/include/net/nfc/shdlc.h b/include/net/nfc/shdlc.h deleted file mode 100644 index 35e930d2f63..00000000000 --- a/include/net/nfc/shdlc.h +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012 Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | ||
17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | */ | ||
19 | |||
20 | #ifndef __NFC_SHDLC_H | ||
21 | #define __NFC_SHDLC_H | ||
22 | |||
23 | struct nfc_shdlc; | ||
24 | |||
25 | struct nfc_shdlc_ops { | ||
26 | int (*open) (struct nfc_shdlc *shdlc); | ||
27 | void (*close) (struct nfc_shdlc *shdlc); | ||
28 | int (*hci_ready) (struct nfc_shdlc *shdlc); | ||
29 | int (*xmit) (struct nfc_shdlc *shdlc, struct sk_buff *skb); | ||
30 | int (*start_poll) (struct nfc_shdlc *shdlc, | ||
31 | u32 im_protocols, u32 tm_protocols); | ||
32 | int (*target_from_gate) (struct nfc_shdlc *shdlc, u8 gate, | ||
33 | struct nfc_target *target); | ||
34 | int (*complete_target_discovered) (struct nfc_shdlc *shdlc, u8 gate, | ||
35 | struct nfc_target *target); | ||
36 | int (*data_exchange) (struct nfc_shdlc *shdlc, | ||
37 | struct nfc_target *target, | ||
38 | struct sk_buff *skb, struct sk_buff **res_skb); | ||
39 | int (*check_presence)(struct nfc_shdlc *shdlc, | ||
40 | struct nfc_target *target); | ||
41 | }; | ||
42 | |||
43 | enum shdlc_state { | ||
44 | SHDLC_DISCONNECTED = 0, | ||
45 | SHDLC_CONNECTING = 1, | ||
46 | SHDLC_NEGOCIATING = 2, | ||
47 | SHDLC_CONNECTED = 3 | ||
48 | }; | ||
49 | |||
50 | struct nfc_shdlc { | ||
51 | struct mutex state_mutex; | ||
52 | enum shdlc_state state; | ||
53 | int hard_fault; | ||
54 | |||
55 | struct nfc_hci_dev *hdev; | ||
56 | |||
57 | wait_queue_head_t *connect_wq; | ||
58 | int connect_tries; | ||
59 | int connect_result; | ||
60 | struct timer_list connect_timer;/* aka T3 in spec 10.6.1 */ | ||
61 | |||
62 | u8 w; /* window size */ | ||
63 | bool srej_support; | ||
64 | |||
65 | struct timer_list t1_timer; /* send ack timeout */ | ||
66 | bool t1_active; | ||
67 | |||
68 | struct timer_list t2_timer; /* guard/retransmit timeout */ | ||
69 | bool t2_active; | ||
70 | |||
71 | int ns; /* next seq num for send */ | ||
72 | int nr; /* next expected seq num for receive */ | ||
73 | int dnr; /* oldest sent unacked seq num */ | ||
74 | |||
75 | struct sk_buff_head rcv_q; | ||
76 | |||
77 | struct sk_buff_head send_q; | ||
78 | bool rnr; /* other side is not ready to receive */ | ||
79 | |||
80 | struct sk_buff_head ack_pending_q; | ||
81 | |||
82 | struct workqueue_struct *sm_wq; | ||
83 | struct work_struct sm_work; | ||
84 | |||
85 | struct nfc_shdlc_ops *ops; | ||
86 | |||
87 | int client_headroom; | ||
88 | int client_tailroom; | ||
89 | |||
90 | void *clientdata; | ||
91 | }; | ||
92 | |||
93 | void nfc_shdlc_recv_frame(struct nfc_shdlc *shdlc, struct sk_buff *skb); | ||
94 | |||
95 | struct nfc_shdlc *nfc_shdlc_allocate(struct nfc_shdlc_ops *ops, | ||
96 | struct nfc_hci_init_data *init_data, | ||
97 | u32 protocols, | ||
98 | int tx_headroom, int tx_tailroom, | ||
99 | int max_link_payload, const char *devname); | ||
100 | |||
101 | void nfc_shdlc_free(struct nfc_shdlc *shdlc); | ||
102 | |||
103 | void nfc_shdlc_set_clientdata(struct nfc_shdlc *shdlc, void *clientdata); | ||
104 | void *nfc_shdlc_get_clientdata(struct nfc_shdlc *shdlc); | ||
105 | struct nfc_hci_dev *nfc_shdlc_get_hci_dev(struct nfc_shdlc *shdlc); | ||
106 | |||
107 | #endif /* __NFC_SHDLC_H */ | ||