In the endpoint descriptor, bMaxPacketSize gives the maximum number of data bytes per transaction. A USB transfer is made up of one or more transactions.
The transfer's total payload size and/or end of transfer indicator are defined by the class or vendor-defined protocol that the host assigns to the device. Often, end of transfer is indicated by a less-than-maximum-size data packet (which can be a 0-length data packet). For some classes, higher-level protocols such as SCSI or Ethernet (USB communications class) provide the payload size.