Use "who" when the relative pronoun is functioning as the subject of the relative clause. Use "whom" when it is functioning as the object of the relative clause.