NFC: digital: Implement NFC-DEP max payload lengths

The maximum payload for NFC-DEP exchanges (i.e., the
number of bytes between SoD and EoD) is negotiated
using the ATR_REQ, ATR_RES, and PSL_REQ commands.
The valid maximum lengths are 64, 128, 192, and 254
bytes.

Currently, NFC-DEP code assumes that both sides are
always using 254 byte maximums and ignores attempts
by the peer to change it.  Instead, implement the
negotiation code, enforce the local maximum when
receiving data from the peer, and don't send payloads
that exceed the remote's maximum.  The default local
maximum is 254 bytes.

Reviewed-by: Thierry Escande <thierry.escande@linux.intel.com>
Tested-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Mark A. Greer
2014-09-23 16:38:08 -07:00
committed by Samuel Ortiz
parent 485fdc9bb6
commit b08147cbc4
2 changed files with 101 additions and 10 deletions

View File

@@ -227,6 +227,9 @@ struct nfc_digital_dev {
u8 curr_nfc_dep_pni;
u8 did;
u8 local_payload_max;
u8 remote_payload_max;
u16 target_fsc;
int (*skb_check_crc)(struct sk_buff *skb);