US Defense Secretary Jim Mattis has visited Kabul to pledge support for the government of President Ashraf Ghani, with the precarious security in the Afghan capital underlined by a rocket attack on the airport hours after he touched down.